4

I have MP3 audio that I would like to turn into video, by joining the audio with a solid black background. I then want to upload the video to Youtube.

Using ffmpeg, I have tried this command, and a few adjacent variants:

ffmpeg -i 'black.png' -i 'input.mp3' -c:v libx264 -tune stillimage -c:a copy 'output.mp4'

(where black.png is a PNG file that is 640×480 pixels).

However, when uploading the video output.mp4 to Youtube via Creator's Studio, I get the error:

Processing abandoned. The video could not be processed.

What could be the reason?

3

Youtube requires a video stream but your image is a single frame. Loop it to create a stream and terminate output when audio ends by adding -shortest.

ffmpeg -loop 1 -i black.png -i 'input.mp3' -c:v libx264 -tune stillimage -shortest 'output.mp4'

I don't remember if YT accepts MP3 in MP4. If it does, you can keep -c:a copy. -pix_fmt yuv420p is usually required, but YT will re-encode anyway to that pixel format.

| improve this answer | |
6

Alternatively you can have ffmpeg generate the black video with the color source filter instead of making an image:

ffmpeg -f lavfi -i color=c=black:s=1280x720:r=5 -i audio.mp3 -crf 0 -c:a copy -shortest output.mp4
  • Since it is just black video this is one case with lossless mode (-crf 0) will have a smaller file size than the default lossy mode.

  • The resulting file may not play in your player or device, but it will on YouTube.

| improve this answer | |
1

Probably becaue pixel format is wrong, add to command: -pix_fmt yuv420p

| improve this answer | |
  • I will add that to the command, thanks. But unfortunately it didn't help with the upload issue. – P A N Feb 14 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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