[FFmpeg-user] Stream specifier ':a' in filtergraph Error

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Wed Nov 11 22:59:26 EET 2020

On 2020-11-10 13:27, Randy Johnson via ffmpeg-user wrote:
> When running the following command:
> ```
> ffmpeg \
> -loop 1 -framerate 30 -t 1.4 -i /assets/img/filler640480.jpg -i 0d.mp4 -
> y \
> -loop 1 -framerate 30 -t 891.113 -i /assets/img/filler640480.jpg -i
> 9f.mp4 -y \
> -f lavfi -t 0.1 -i anullsrc=channel_layout=mono:sample_rate=48000 \
> -filter_complex "
> [0:v]setsar=1[v0];[2:v]setsar=1[v1];[v0][4:a][1:v][1:a][v1][4:a][3:v][3:a]concat=n=4:v=1:a=1"
> -vsync 2 -vcodec libx264 -pix_fmt yuv420p 0245-grid.mp4
> ```
> I am getting the following error:
> ```
> Stream specifier ':a' in filtergraph description
> [0:v]setsar=1[v0];[2:v]setsar=1[v1];[v0][4:a][1:v][1:a][v1][4:a][3:v][3:a]concat=n=4:v=1:a=1
> matches no streams.
> ```
> This only happens on some video processing not all, cannot seem to
> figure out why.

I agree with Michael Koch's earlier answer, but let me try to explain 
what FFmpeg is trying to tell you.

Within a video file, each sequence of video images, and each audio 
channel, is a stream. Some files might have a single video stream and a 
two audio streams (stereo sound). Some might have a video stream and one 
audio stream (monophonic sound). Some might have a video stream and no 
audio stream at all (silent video).

Your complex filter operates on multiple streams, in parallel. Those 
notations "1:v", "4:a" are _stream specifiers_. The documentation of 
stream specifiers is at 

FFmpeg gives you an error message, "Stream specifier ':a' in filtergraph 
description … matches no streams."  ":a" is a stream specifier for an 
audio stream (see the documentation, under "stream_type"). Look in the 
"[0:v]setsar"…"concat=n=4:v=1:a=1" code — that is your filtergraph 
description — for stream specifiers ending in ":a". Those are what 
FFmpeg cannot match to a stream in the input files.

As Andrei Ka points out, you can look in the FFmpeg output for a 
description of what streams FFmpeg finds in the input files. I suspect 
that in the cases where your invocation succeeds, FFmpeg will tell you 
that each of the input files has an audio stream. In the cases where 
your invocation fails, FFmpeg will tell you that at least one of the 
input files has no audio stream.

If it is the case that some of your files have no audio streams, then 
you have two basic choices:

1. Generate an FFmpeg invocation tailored to the details of your input 
files. Don't generate instructions to concatenate audio streams for 
files which have none, but do generate for files which do have audio.

2. Generate a more elaborate FFmpeg invocation which will generate 
silent audio streams for input files which have none. The details of 
this should be in a separate thread with a separate Subject: line.

I hope this is helpful,
        —Jim DeLaHunt, software engineer, Vancouver Canada

More information about the ffmpeg-user mailing list