6

In ffmpeg, I have the following filter_complex:

color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t];
[1:v] trim=start=114.149:end=124.149,setpts=PTS-STARTPTS [v0];
[t][v0]overlay=0:0:enable='between(t,0,10)' [o0];
[2:v] trim=start=118.112:end=135.112,setpts=PTS-STARTPTS [v1];
[o0][v1]overlay=0:0:enable='between(t,10,27)' [o1];
[o0][o1]concat=n=2:v=1:a=0 [vout]

But when I run the command with 3 inputs (the first one is an audio file), I get:

Stream specifier 'o0' in filtergraph description color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t]; [1:v] trim=start=114.149:end=124.149,setpts=PTS-STARTPTS [v0]; [t][v0]overlay=0:0:enable='between(t,0,10)' [o0]; [2:v] trim=start=118.112:end=135.112,setpts=PTS-STARTPTS [v1]; [o0][v1]overlay=0:0:enable='between(t,10,27)' [o1]; [o0][o1]concat=n=2:v=1:a=0 [vout] matches no streams.

What am I doing wrong?

Using a git version from ~1 week ago.

2 Answers 2

6

For future reference:

as specified, you cannot reuse an intermediate stream more than once so you have 2 options:

  1. either save it, input the saved file and reuse it as many times you need in your filter;

ffmpeg -i file1 -i file2 -i savedStream -filter_complex "..."

  1. use the split filter and create as many outputs you need; default value for split is 2 outputs so:

[o0]split[split1][split2]

would be your case.

2

It looks like an intermediary stream, as produced by the color filter, cannot be reused more than once, so we have to use the split filter on it:

color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t];
[t] split=2 [s0][s1];
[1:v] trim=start=114.149:end=125.149,setpts=PTS-STARTPTS [v0];
[s0][v0]overlay=0:0:enable='between(t,0,11)' [o0];
[2:v] trim=start=115.629:end=123.629,setpts=PTS-STARTPTS [v1];
[s1][v1]overlay=0:0:enable='between(t,11,19)' [o1];
[o0][o1]concat=n=2:v=1:a=0 [vout]

I couldn't find any explicit documentation on that limitation, altough I'm sure it exists somewhere.

1
  • Workaround is to generate it as an input stream alongside other file inputs: -i file -i file -f lavfi -i "color=c=Chartreuse... and then ingest it repeatedly like other files [2:v]...
    – Gyan
    Commented Apr 6, 2018 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.