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
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"