[FFmpeg-user] streamselect in a realtime application

Gyan Doshi ffmpeg at gyani.pro
Thu Jun 16 10:53:13 EEST 2022

On 2022-06-16 01:17 pm, Michael Koch wrote:
> Am 16.06.2022 um 09:33 schrieb Gyan Doshi:
>> On 2022-06-16 12:45 pm, Michael Koch wrote:
>>> I would like to understand why in some cases -loop 1 is required 
>>> before the input files, and in some cases it can be omitted.
>> -loop option is specific to the image sequence demuxer. Without it, a 
>> single image input is a video stream of 1 frame length.
> But why does this example work without  -loop 1? Is it an undocumented 
> feature of the remap filter, that it keeps the last mapping file alive?
> ffmpeg -i in.mp4 -i xmap.pgm -i ymap.pgm -lavfi [0][1][2]remap out.mp4

remap uses framesync which by default, repeats last frame of secondary 
input if primary input is still alive.

>> You would apply loop when you need to keep alive an image sequence 
>> input at a timestamp beyond its natural length, usually a fade.
>> With the tpad or loop filters, this can be done inside a filtergraph 
>> instead of at the demuxer level.
> Which method is better, -loop 1 before the input file, or doing it in 
> the filtergraph?

For single image input, filter looping is better as it avoids file I/O 
and repeat decoding of the input.


More information about the ffmpeg-user mailing list