1

I am using Ubuntu 14.04. How can I add an image at the end of a video from the terminal? For example, I have a video called input.mp4, and I want to add an image called input.png showing my Facebook and Twitter accounts to the end of that video and output the results to a new video called output.mp4. How can I do that from the command-line?

 ________                          ________            ________
|        |                        |        |          |        |
| input  |  add image at the end  | input  |  avconv  | output |  
| mp4    |  ------------------->  | png    |  ----->  | mp4    | 
|________|                        |________|          |________|
0

1 Answer 1

1

The easiest way to do this with ffmpeg is create a video with just the png file

ffmpeg -loop 1 -i input.png -c:v libx264 -t 30 -pix_fmt yuv420p picture.mp4

Note: -t 30is how long you want the image to be displayed for in seconds

Then combine the two into a single video

ffmpeg -i "concat:input.mp4|picture.mp4" -c copy output.mp4

Hope that helps!

Good luck :)

6
  • I just try this in Ubuntu 18 and the concat dont works..
    – mlacunza
    May 27, 2018 at 21:06
  • @mlacunza - This was for Ubuntu 14.04. Please start a new question if you're having issues with a later version of Ubuntu. Jun 1, 2018 at 10:20
  • Many commands work in all Linux and in most of the new versions, is valid my comment because it's an update of your post
    – mlacunza
    Jun 1, 2018 at 14:42
  • @mlacunza - A valid point, but not relevant to the original post. Either edit the original question to include all versions of Ubuntu, then edit the answer to reflect the change, OR start a new question if you need help. Jun 2, 2018 at 10:46
  • 1
    Great solution. Much more successful than trying to encode it all at once. Note I used yuvj420p instead of yuv420p to match my video, and used an image editor to resize the images to match the video resolution first. For the latest on doing the concatenation, use the easy instructions here: trac.ffmpeg.org/wiki/Concatenate Aug 15, 2019 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .