mead650
mead650

Reputation: 21

Converting mp3 and jpg to mp4 with h.264 and aac

I have over 500 sermons in audio format (.mp3). I want to use FFMPEG because its free and I like the software.

I am trying to combine the .mp3s with a jpg (picture of my church) to create .mp4 for Youtube.

I know that YouTube usually does well with Audio format:aac or mp3 and Video format:AVC with h.264.

here is the code:

FOR %%a IN (audio/*.mp3) DO (
echo Converting: %%a
ffmpeg -i image/img.jpg -i "%%a" -c:v copy -c:a -vcodec libx264 -acodec aac -strict -2 videos/%%~na.mp4
)
echo Finished

I have the FFMPEG with a do loop, but I am getting this error, [NULL @ 000002574bea6b40] Unable to find a suitable output format for 'libx264' libx264: Invalid argument

I have the latest version. Anytakers?

Upvotes: 1

Views: 603

Answers (1)

Gyan
Gyan

Reputation: 92928

In your ffmpeg command,

ffmpeg -i image/img.jpg -i "%%a" -c:v copy -c:a -vcodec libx264 -acodec aac -strict -2 videos/%%~na.mp4, you've missed out on the value for -c:a so ffmpeg is taking -vcodec as its value which leaves libx264 unpaired. This causes ffmpeg to treat it as an output name. Since there's no extension, ffmpeg can't figure out what format "libx264' is supposed to be.

Add aac after -c:a i.e. -c:a aac

ffmpeg -i image/img.jpg -i "%%a" -c:v copy -c:a aac -strict -2 videos/%%~na.mp4

Upvotes: 1

Related Questions