Converting mp3 to mp4 with Image Using Ffmpeg

1

I'm trying to take an mp3 I have, and turn it into a video when combined with an image.

When I try, however, two things happen:

First, it won't play in Quicktime, even when I use -pix_fmt yuv420p.

Second, it gives me this error:

[mp4 @ 0x7fe3af809000] Codec for stream 1 does not use global headers but container format requires global headers

So I'm not sure what I'm doing wrong.

Here's my command:

ffmpeg -i "$mp3" -loop 1 -i "$image" -c:a copy -c:v libx264 -pix_fmt yuv420p -shortest "$mp4"

Any idea why this might be happening?

devbanana

Posted 2016-12-14T14:36:46.490

Reputation: 125

Answers

1

MP3 audio isn't officially supported in MP4 files, so Quicktime won't play it. The video stream doesn't come into it. Outputting to MOV will get around that, as will playing the MP4 in other players. Converting to AAC will also work for QT.

You can add -flags +global_header to have that added for the audio stream.

Gyan

Posted 2016-12-14T14:36:46.490

Reputation: 21 016