0

Trying on converting an mp3 audio and a jpeg image as background image into a mp4 video, video conversion should terminate after it reaches the audio play length.

Here's the ffmpeg commandline. The conversion is successful and encoded mp4 audio is also good, but the image don't seem to appear. Do I have to specify a screen resolution? Am I making any mistake? How can I make the command more faster (I can't use -c:a copy as I may be converting other audio formats)?

ffmpeg -y -loop 1 -framerate 15 -i  "/storage/emulated/0/Download/Kites.jpg" -i "/storage/emulated/0/Download/myaudio.mp3" -c:v libx264 -c:a libmp3lame -shortest "/storage/emulated/0/Download/Out.mp4"
ark1974
  • 615
  • 5
  • 16
  • 1
    Add `-vf format=yuv420p` output option. That solves the main issue. Unrelated suggestions: use `-c:a aac` as MP3 is generally less compatible than AAC in MP4, or if you require MP3, use `-c:a copy` since input is already MP3. Add the `-movflags +faststart` option for fast start playback. – llogan Apr 29 '20 at 04:16
  • @llogan: I tried like so `..Out.mp4" -vf format=yuv420p`. Is the command ok?. Still no video frames. Will specifying a screen resolution help?Any clue? Thanks. – ark1974 Apr 29 '20 at 04:22
  • 1
    Option placement matters: `ffmpeg [global options] [input options] -i input [output options] output`, so your command should be `ffmpeg -y -loop 1 -framerate 15 -i "/storage/emulated/0/Download/Kites.jpg" -i "/storage/emulated/0/Download/myaudio.mp3" -c:v libx264 -vf format=yuv420p -c:a libmp3lame -shortest "/storage/emulated/0/Download/Out.mp4"` – llogan Apr 29 '20 at 04:23
  • Wow! it works like charm now. Can you post this as answer, I will accept it ? +1 for aac. Thanks. – ark1974 Apr 29 '20 at 04:27
  • I would, but I marked it as a duplicate as the yuv420p thing is a super common question here. – llogan Apr 29 '20 at 04:28

0 Answers0