Converting large number of MP3 files to videos for YouTube, each using same JPG

Looking for a way to convert large number of mp3 files to videos each using the same image. Efficient processing time is important.

Tried following:

ffmpeg -i image.jpg -i audio.mp3 -vcodec libx264 video.mp4

VLC played the resulting video file with the correct sound, but blank screen. Microsoft Media Player played the sound and showed the intended image. Uploaded the video to YouTube and received mesage "The video has failed to process. Please make sure you are uploading a supported file type."

Would appreciate advice on how to make this work.

1 answer

  • answered 2020-06-02 04:16 llogan

    1. Create video:

      ffmpeg -framerate 6 -loop 1 -i input.jpg -c:v libx264 -vf format=yuv420p -t 00:10:00 video.mp4
      

      The duration (-t) should be ≥ the MP3 with the longest duration.

    2. Now stream copy the same video for each MP3:

      ffmpeg -i video.mp4 -i audio.mp3 -map 0:v -map 1:a -c copy -movflags +faststart -shortest output.mp4
      

    Some notes regarding compatibility:

    • MP3 in MP4 does not have universal support, but will be fine in YouTube. If your target players do not like it then add -c:a aac after -c copy to output AAC audio.
    • If your target player does not like it then increase the -framerate value or add the -r output option with an appropriate value, such as -r 15. Again, YouTube should be able to handle it.