[FFmpeg-user] delay a video in a filter chain

Michael Koch astroelectronic at t-online.de
Mon Jun 10 17:13:13 EEST 2019


>
> I want to delay a video in a filter chain by 5 seconds, and then 
> combine it with the original video with hstack. I use the shortest=1 
> option, so that the output contains only the duration where both 
> videos overlap:
>
> ffmpeg -f lavfi -i testsrc=duration=10:size=vga:rate=25 
> -filter_complex 
> split[a][b];[b]setpts=PTS+5/TB[c];[a][c]hstack=shortest=1 -y out1.mp4
>
> This works as expected. The input length is 10s and the output length 
> is 5s.
>
> However, when I use the same command line with another input video, I 
> don't get the expected result:
>
> ffmpeg -i 308.mov -filter_complex 
> split[a][b];[b]setpts=PTS+5/TB[c];[a][c]hstack=shortest=1 -y out2.mp4

Just found a solution myself. It works fine if the delay time is 
subtracted instead of added:

ffmpeg -i 308.mov -filter_complex 
split[a][b];[b]setpts=PTS-5/TB[c];[a][c]hstack=shortest=1 -y out2.mp4

Michael



More information about the ffmpeg-user mailing list