I'm cutting/converting some videos with ffmpeg. What I'd really like is to be able to have the output hold the last frame for a few seconds (with silence for audio). Is such a thing possible? Or will I have to somehow get the last frame and make a new video from that?
One method is to use the
overlay video filter. Assuming your video is 640x480, 30 seconds duration, 25 frame rate:
ffmpeg -f lavfi -i nullsrc=s=640x480:d=35:r=25 -i video.mp4 -i audio.wav -filter_complex \ "[0:v][1:v]overlay[video]" -map "[video]" -map 2:a -codec:a copy -shortest output.mkv
I set the duration of the
nullsrcsource filter to be 5 seconds longer than
The default behavior of overlay is to repeat the last frame of the overlaid source. See the
eof_actionoption for other behaviors.
The audio in this example is being stream copied (re-muxed) instead of being re-encoded.
The downside is that this examples requires re-encoding since a filter is being used, but it may be simpler than other methods since it is just one command.
The currently accepted answer is from 2014. The more recently added
tpad filter lets you do this more easily.
ffmpeg -i in.mp4 -vf tpad=stop_mode=clone:stop_duration=2 out.mp4
I believe the answer to your question is "yes". I'm not super familiar with FFMPEG, but the easiest way I can see to accomplish your goal is to first extract the last frame to an image, make a video of a few seconds and then run an encode that concatenates the main video and your newly created video in one pass.