I'd like to add some images at the end of a mp4 file via ffmpeg:

enter image description here

Any help would be greatly appreciated.


Use this command:

ffmpeg -i "video" -loop 1 -t 3 -i "image" -f lavfi -t 3 -i anullsrc -filter_complex "[0:v] [0:a] [1:v] [2:a] concat=n=2:v=1:a=1 [v] [a]" -c:v libx264 -c:a aac -strict -2 -map "[v]" -map "[a]" output.mp4

Replace the t value with the duration that you want the image to stay. I've supplied the common encoding parameters. Replace those as needed.

For an image sequence, use

ffmpeg -i "video" -f image2 -framerate n -i "image" -f lavfi -t 3 -i aevalsrc=0 -filter_complex "[0:v] [0:a] [1:v] [2:a] concat=n=2:v=1:a=1 [v] [a]" -c:v libx264 -c:a aac -strict -2 -map "[v]" -map "[a]" output.mp4

Replace the n in framerate with the rate that you want.

  • Great work. Unfortunately doesn't work with audio-less videos. Could you add enough explanation to allow one to manipulate it to suit? – Heath Raftery Aug 15 '19 at 21:38

Refer to this command:

ffmpeg -y -i input.mp4 -loop 1 -framerate 25 -t 3 -i foo.jpg -t 3 -f lavfi -i aevalsrc=0 -i bar.png -filter_complex '[1:0]scale=640:480[curtain];[0:0][0:1][curtain][2:0] concat=n=2:v=1:a=1[out];[out][3:0]overlay=W-w-25:H-h-25' -max_muxing_queue_size 1000 output.mp4 -loglevel 'trace'

this will add an image at end of the mp4 ,and add watermake to the mp4.

  • 2
    Can you explain some of the options given to ffmpeg since readers may need to change them to fit their situation (for example, -framerate)? Why do you specify -loglevel 'trace'? That doesn't seem necessary for the command to complete properly. – Michael Liebman Jun 29 '17 at 22:50

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.