FFMpeg concatenation filters: stream specifier: 0 'in filtergraph does not match threads

I am developing an application that relies heavily on FFMpeg to perform various conversions in audio files. I am currently testing my FFMpeg configuration on the command line.

I am trying to combine several audio files that are in different formats (primarily MP3, MP2 and WAV). I used the official TRAC documentation ( https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join%2C%20merge)%20media%20files#differentcodec ) to help me with this and created the following command:

ffmpeg -i OHIn.wav -i OHOut.wav -filter_complex '[0:0] [1:0] concat=n=2:a=1 [a]' -map '[a]' output.wav 

However, when I run this on Mac OS X using FFMpeg version 2.0.1, I get the following error message:

 Stream specifier ':0' in filtergraph description [0:0] [1:0] concat=n=2:a=1 [a] matches no streams. 

Here is my complete output from the terminal:

 ~/ffmpeg -i OHIn.wav -i OHOut.wav -filter_complex '[0:0] [1:0] concat=n=2:a=1 [a]' -map '[a]' output.wav ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers built on Aug 15 2013 10:56:46 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.102 / 55. 18.102 libavformat 55. 12.100 / 55. 12.100 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 79.101 / 3. 79.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, wav, from 'OHIn.wav': Duration: 00:00:06.71, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, wav, from 'OHOut.wav': Duration: 00:00:07.19, bitrate: 1411 kb/s Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream specifier ':0' in filtergraph description [0:0] [1:0] concat=n=2:a=1 [a] matches no streams. 

I do not understand why this is not working. FFMpeg shows that streams 0: 0 and 1: 0 exist in the source files. The only other similar issues on the Internet surrounded the use of a single quote in Windows, however checking this confirmed that it did not apply to my Mac command line.

Any help would be greatly appreciated.

+7
ffmpeg audio
source share
3 answers

You need to tell the concat filter the number of output video streams. By default, v=1 for video and a=0 for audio, but you do not have video streams. It is better not to rely on the default values. Manually list the number of input segments ( n ), output video streams ( v ), and output audio streams ( a ).

 ffmpeg -i input0.wav -i input1.wav -filter_complex "[0:a][1:a]concat=n=2:v=0:a=1[a]" -map "[a]" output.wav 

Note that I added v=0 .

See the concat filter documentation for more information.

+11
source share

In addition to fulfilling the answer of Lord Neckbeard, which solved my problem: I wanted to present a working example of the Bash Shell script, showing how I combine three mp3 files (intro, middle and outro, each of which has the same transfer speed of 160 kbps, frequency 44.1 kHz sampling) into one mp3 result. The reason my filter graph is being read:

[0:a] [1:a] [2:a]

instead of something like:

[0:0] [1:0] [2:0]

lies in the fact that some mp3 files contain artwork that ffmpeg sees as two streams for each input mp3 file, one sound (for the music itself) and one video (for the image file).

Part :a lets ffmpeg know that you want it to use only the audio stream that it reads for this input file, and pass that along with the concat filter. Therefore, any video filters are ignored. The advantage of this is that you do not need to know the position of the video stream (so that you do not accidentally miss it), as indicated in the command:

ffprobe control-intro-recording.mp3 .

Anyway, I digress, here is the shell script:

 #!/bin/sh ffmpeg -i ./source-files/control-intro-recording.mp3 \ -i ./source-files/control-middle-1-hour-recording-with-artwork-160-kbps.mp3 \ -i ./source-files/control-outro-recording.mp3 \ -filter_complex '[0:a] [1:a] [2:a] concat=n=3:v=0:a=1 [a]' \ -map '[a]' ./output-files/control-output-with-artwork-160-kbps-improved.mp3 
+5
source share

I ran into this error Stream specifier ':0' in filtergraph description [0:0] [1:0] ... trying to merge two video files. @LordNeckbeard's answer helped me diagnose the problem. I mention this as a separate answer if a future querent, like me, is faced with this situation with video files.

It turned out that one of my videos did not have an audio track. Adding an audio track using

 ffmpeg -f lavfi -i aevalsrc=0 -i title-slide.mp4 -shortest -c:v copy \ -c:a mp3 -strict experimental title.mp4 

made me go.

0
source share

All Articles