Some devices do not like MP3 audio in MP4 container. AAC audio is more common. A simple command:
ffmpeg -i video -i audio -map 0:v -map 1:a -codec:v copy -codec:a aac \
-strict experimental -b:a 192k -shortest output.mp4
Note that I changed -map 0 -map 1
to -map 0:v -map 1:a
to be more specific, because you probably do not want ffmpeg to include any album art from the audio input (it would create an additional, separate video stream).
A more specific command for your case. You can do everything in one command instead of two:
ffmpeg -framerate 1/5 -i %03d.jpg -i audio.mp3 -map 0:v -map 1:a -c:v libx264 \
-profile:v baseline -level 3.0 -r 30 -pix_fmt yuv420p -c:a aac \
-strict experimental -b:a 192k -shortest output.mp4
This example uses the native FFmpeg AAC encoder. It is considered experimental, so results may vary, but it is not a terrible encoder with enough bitrate.
If you have other AAC encoders supported by your
ffmpeg
then refer to the FFmpeg and AAC Encoding Guide for additional suggestions, examples, and information.You may experience several issues, such as frames being skipped, when making a video from images. See the answer to FFmpeg slideshow from images - only one frame shown for solutions.