So, I need to make a video out of 2 images, and later add music.

This is the instruction I found: https://trac.ffmpeg.org/wiki/Slideshow

I tried this command:

ffmpeg -f concat -i ffmpeg_input.txt -vsync vfr -pix_fmt yuv420p output.mp4

The ffmpeg_input.txt contains this:

file 'wow.jpg'
duration 219
file 'wow2.jpg'
duration 1
file 'wow2.jpg'

This kinda works, but when I try to add music, I get a bugged video: when I open it, it starts playing with a correct size and duration, but no video or audio is heard. I hear the audio after I seek closer to the end and then seek back,

This is how I convert .wav to .m4a:

ffmpeg -i _done.wav -c:a aac -b:a 160k _done.m4a

And this is how I merge video and audio together:

ffmpeg -i output.mp4 -i _done.m4a -c copy output_final.mp4

I probably should try sony vegas or such already.


You can simply add everything in one go:

ffmpeg -f concat -i ffmpeg_input.txt \
-i _done.wav -c:a aac -b:a 160k \
-vsync vfr -pix_fmt yuv420p \
  • Thanks. Still something wrong with the video though. It's as if the video turns out to be very low fps, and this somehow makes my player bug out. – woopwoop399 Feb 11 at 13:54
  • That's the variable frame rate which might be incompatible with some players. Does it work in ffplay? – slhck Feb 11 at 14:17
  • Yes. Only seeking doesn't work, but it plays fine. – woopwoop399 Feb 11 at 14:34
  • You could re-convert into CFR by ffmpeg -i output.mp4 -r 30 -crf 18 -c:a copy output2.mp4, but note that this will re-encode and therefore degrade video quality a little. I chose CRF 18, but you can pick any other sane value: slhck.info/video/2017/02/24/crf-guide.html – slhck Feb 12 at 9:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.