Answers.Body: <p>Try</p>
  
  <pre><code>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
  </code></pre>
  
  <p>If this still drops frames, then you should insert a FIFO filter for the 2nd video after the setpts, like this:</p>
  
  <pre><code>[2:v]setpts=(PTS-STARTPTS)+2/TB,fifo[2v]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-13T19:48:39.830Z
Answers.Text: 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!
Answers.UserDisplayName: HDL
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-13T18:58:30.940Z
Answers.LastActivityDate: 2016-11-13T18:58:30.940Z
Answers.UserDisplayName: Gyan
Body: <p>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?</p>
  
  <pre><code>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
  </code></pre>
  
Tags: <video><ffmpeg><transcoding><filter>
Title: Delaying video overlay in ffmpeg without frame drops
UserDisplayName: HDL
ThreadText: # Delaying video overlay in ffmpeg without frame drops
  
  (Asked by: username_0 on 2016-11-13)
  
  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
  
  ```
  
  **Tags:** video, ffmpeg, transcoding, filter
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-13. Score: 0 | Accepted answer
  
  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]
  
  ```
  
  > **Comments:**
  > **username_0**: 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!  
  
  ---
  
  