pablosz
pablosz

Reputation: 55

Use ffmpeg to encode AUDIO+IMAGE into a VIDEO for YouTube

I need to generate a video containing a single image throughout the duration of the audio comming from an audio file. This video should be compatible with the parameters supported by YouTube.

I'm using ffmpeg.

I was trying various configurations explained right here and in other forums but not all have worked well.

I'm currently using these settings:

ffmpeg -i a.mp3 -loop 1 -i a.jpg -vcodec libx264 -preset slow -crf 20 -threads 0 -acodec copy -shortest a.mkv

Where a.mp3 containing audio, a.jpg contains the image and a.mkv is the name of the resulting video.

Using these parameters a.mkv works well on YouTube and can be played with Media Player Classic; but KMPlayer only recognizes the audio, showing a blank image as background.

My questions are two: 1 - There is something wrong that causes KMPlayer to fail? 2 - Is there any configuration that can deliver the video faster, of course losing some compression?

Muchas gracias!

Upvotes: 2

Views: 820

Answers (1)

Tool Man
Tool Man

Reputation: 311

Try this:

ffmpeg -i a.mp3 -loop 1 -r 1 -i a.jpg -vcodec libx264 -preset ultrafast -crf 20 -threads 0 -acodec copy -shortest -r 2 a.mkv

Notable changes:

added -r 1

changed -preset slow to -preset ultrafast

added -r 2

Upvotes: 3

Related Questions