# tested with: https://www.shutterstock.com/video/clip-3885476 TMP=. SRC=countdown.mp4 DST=output.mp4 FREEZE_S=10 cd "$TMP" # get last frame NFRAMES=`ffprobe -show_streams "$SRC" 2> /dev/null | grep nb_frames | head -1 | cut -d \= -f 2` let "LAST_FRAME = $NFRAMES - 1" ffmpeg -i $SRC -vf select=\'eq\(n,$LAST_FRAME\) -vframes 1 LAST_FRAME.jpg # make last-frame-frozen video FRAMERATE=$(ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate "$SRC") ffmpeg -loop 1 -framerate 1 -i LAST_FRAME.png -r "$FRAMERATE" -t "$FREEZE_S" -pix_fmt yuv420p LAST_FRAME.mp4 # Produces list.txt like this: # file foo.mp4 # file 'bar with spaces.mp4' printf "file %q\n" "$SRC" LAST_FRAME.mp4 > list.txt # concatenate ffmpeg -y -f concat -safe 0 -i list.txt -c copy "$DST" # green-screen for LAST_FRAME.mp4 duration # Alternative: # ffmpeg -i "concat:$SRC|LAST_FRAME.mp4" -c:a copy -c:v copy "$DST" # <-- no LAST_FRAME.mp4