Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by throw_m239339 on Sunday November 15, 2020 @07:49PM
(#25106651)
Does anybody know how to overlay a shorter footage on a longer one? Because the shortest footage just freeze at the last frame in the tutorial. I want the shorter overlaid footage to loop on top of the longer one, Here is what I've tried:
The shortest footage (Old Film Grain.mp4) doesn't loop as an overlay.
[ Parent
| on HN ]
Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by __zayne__ on Sunday November 15, 2020 @08:13PM
(#25106830)
I like to get the duration of the base video using ffprobe, then use -stream_loop -1 to loop the overlay video on top of it, while using -t with the duration before the output to ensure it will only be as long as the duration of the base video. Here's an example:
DURATION="$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv='p=0')"
ffmpeg -i input.mp4 -stream_loop -1 -i overlay.mp4 -filter_complex "
[1]colorchannelmixer=aa=0.1[2];[2][0]scale2ref[2][1];[1]
[2]overlay" -t $DURATION output.mp4
Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by _Gyan_ on Monday November 16, 2020 @01:23AM
(#25108703)
ffprobe step nor -t needed.
ffmpeg -i input.mp4 -stream_loop -1 -i overlay.mp4 -filter_complex "
[1]colorchannelmixer=aa=0.1[2];[2][0]scale2ref[2][1];[1]
[2]overlay=shortest=1" -shortest -fflags +shortest -max_interleave_delta 100M output.mp4
Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by throw_m239339 on Monday November 16, 2020 @12:08AM
(#25108263)
Thanks, adding a duration to the CLI args works well.
Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by mmozeiko on Sunday November 15, 2020 @07:54PM
(#25106681)
Try adding "-stream_loop -1" before first -i argument.
Re:Create Vintage Videos Using FFmpeg in 4 Simple Steps
by throw_m239339 on Monday November 16, 2020 @12:04AM
(#25108243)
thanks, -stream_loop -1 just loops the encoding forever for me, adding a duration with -t fixes it.