I want to freeze some frames in a video so that it gives a buffering video type look. Also the audio should freeze with the video.


Assume there are three pauses of 3 seconds each at 5s, 12s and 20s of the original video. Here's the basic form of the command,

ffmpeg -i in -vf "setpts='PTS-STARTPTS + gte(T,5)*(3/TB) + gte(T,12)*(3/TB) + gte(T,20)*(3/TB)'" -af "asetpts='PTS-STARTPTS + gte(T,5)*(3/TB) + gte(T,12)*(3/TB) + gte(T,20)*(3/TB)',aresample=async=1:first_pts=0" -vsync cfr out

  • I get the following error while running the command: ffmpeg -i abc.avi -vf "setpts='PTS-STARTPTS + gte(t,5)*(3/TB) + gte(t,12)*(3/TB) + gte(t,20)*(3/TB)'" -af "asetpts='PTS-STARTPTS + gte(t,5)*(3/TB) + gte(t,12)*(3/TB) + gte(t,20)*(3/TB)',aresample=async=1:first_pts=0" -vsync crf out.avi error: Expected number for vsync but found: crf if I add -vsync 0, then error: Unable to find a suitable output format for 'crf'
    – mumtaz
    May 23 '19 at 5:21
  • It's not crf, See answer.
    – Gyan
    May 23 '19 at 5:35
  • thanks.. but there is still some error. I have posted it in the answer below.
    – mumtaz
    May 24 '19 at 9:16
  • Your command is missing the * in gte(t,5)*(3/TB) and in other expressions.
    – Gyan
    May 24 '19 at 9:28

The code by @gyan didn't work out for me, I found another (longer) way to do it:

I extracted the audio file from the video first using:

ffmpeg -i input.mp4 -vn -ab 128 audio.mp3

then combined them together with an offset:

ffmpeg.exe -i "input.mp4" -itsoffset 3 -i "input_audio.wav" -map 0:v -map 1:a -c copy "output.mp4"
  • Did you add the *?
    – Gyan
    May 24 '19 at 10:54
  • **yes I did try your code, but it shows error **: ffmpeg -i sb.mp4 -vf "setpts='PTS-STARTPTS + gte(t,5)*(3/TB) + gte(t,12)*(3/TB) + gte(t,20)*(3/TB)'" -af " asetpts='PTS-STARTPTS + gte(t,5)*(3/TB) + gte(t,12)*(3/TB) + gte(t,20)*(3/TB)',aresample=async=1:first_pts=0" -vsync cfr outsb.mp4
    – mumtaz
    May 26 '19 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.