1

I'm trying to play 2 videos overlaid against a static background, with the 2nd video (and its audio) delayed by a couple seconds. When I do this, ffmpeg complains about buffer overflow and the 2nd video drops tons of frames. How do I prevent the frame drops?

ffmpeg -y -loop 1 -i ~/Desktop/FP2.tiff -i ~/Desktop/fp.mov -itsoffset 2 -i ~/Desktop/fp.mov -lavfi \
"[0:v]fps=60[bg]; \
[bg][1:v]overlay=10:(main_h/2)-(overlay_h/2):format=rgb[v1]; \
[v1][2:v]overlay=460:(main_h/2)-(overlay_h/2):shortest=1:format=rgb[final]; \
[2:a]adelay=2000[a2]; \
[1:a][a2]amix=inputs=2[audio]" \
-map "[final]" -map [audio] -c:v ffv1 -level 3 -c:a pcm_s16be ~/Desktop/filtergraph.nut

1 Answer 1

0

Try

ffmpeg -framerate 60 -loop 1 -i ~/Desktop/FP2.tiff -i ~/Desktop/fp.mov -i ~/Desktop/fp.mov \
       -lavfi "[0][1:v]overlay=10:(main_h-overlay_h)/2:format=rgb:shortest=1[v1]; \
               [2:v]setpts=(PTS-STARTPTS)+2/TB[2v]; \
               [v1][2v]overlay=460:(main_h-overlay_h)/2:shortest=1:format=rgb[final]; \
               [2:a]adelay=2000|2000[a2];[1:a][a2]amix=inputs=2[audio]" \
 -map "[final]" -map [audio] -c:v ffv1 -level 3 -c:a pcm_s16be ~/Desktop/filtergraph.nut

If this still drops frames, then you should insert a FIFO filter for the 2nd video after the setpts, like this:

[2:v]setpts=(PTS-STARTPTS)+2/TB,fifo[2v]
1
  • That one works. The "fifo" is needed. I was able to trim the fat on the command as well and get rid of the 2nd reference to the same video input altogether as well. Thanks for the help!
    – HDL
    Nov 13, 2016 at 19:48

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.