Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg: chain of multiple filter_complex, re-using intermediate output stream

Tags:

ffmpeg

How can I apply two filter_complex commands sequentially?

first, I want to blend a video with an image then I want to take the output of that filter and split it into 4 tiles, as described in this post Stackoverflow.

I have tried this: (my strategy was to generate an intermediate output from filter_complex [int] and I wanted to re-use that output twice.

ffmpeg.exe 
-i videoIn.avi 
-i imageIn.avi 
-filter_complex "[1:0] setsar=sar=1 [1sared];[0:0][1sared]blend=all_mode='divide':repeatlast=1[int];
[int]crop=960:960:24:1055:[out1];
[int]crop=960:960:1056:1062:[out2]" 
-map [out1] out1.avi 
-map [out2] out2.avi

however, I am getting an error: Stream specifier 'int' in filtergraph description [int]crop=960:960:24:1055[out1];[int]crop=960:960:1056:1062:[out2] matches no streams

this code works if I only use one crop operation but not with two - so I am guessing the intermediate stream [int] cannot be re-used the way I am trying to do it?

how can I re-use the intermediate stream multiple times for subsequent filters?

like image 517
jlarsch Avatar asked Dec 17 '15 15:12

jlarsch


1 Answers

You have to use the split filter to duplicate the input stream.

Example:

[...] split [crop1][crop2];
[crop1] crop=960:960:24:1055 [out1];
[crop2] crop=960:960:1056:1062 [out2]
like image 169
aergistal Avatar answered Nov 13 '22 11:11

aergistal