将大量 MP3 文件转换为 YouTube 视频,每个文件都使用相同的 JPEG 图像

Converting a large number of MP3 files to videos for YouTube, each using same the JPEG image

我正在寻找一种将大量 MP3 文件转换为视频的方法,每个文件都使用相同的图像。高效的处理时间很重要。

我尝试了以下方法:

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

VLC media player 以正确的声音播放生成的视频文件,但出现黑屏。

Microsoft Media Player 播放了声音并显示了预期的图像。我将视频上传到 YouTube 并收到消息:

"The video has failed to process. Please make sure you are uploading a supported file type."

我怎样才能使这个工作?

  1. 创建视频:

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

    时长(-t)应≥最长时长的MP3

  2. 现在为每个 MP3 流复制相同的视频:

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

关于兼容性的一些注意事项:

  • MP4 中的 MP3 没有普遍支持,但在 YouTube 中可以。如果您的目标玩家不喜欢它,那么在 -c copy 之后添加 -c:a aac 以输出 AAC 音频。
  • 如果你的目标玩家不喜欢它,那么增加-framerate值或者添加-r输出选项并设置一个合适的值,比如-r 15。同样,YouTube 应该能够处理它。