S h o r t S t o r i e s

// Tales from software development

Archive for March 2013

ffmpeg.exe – maybe incorrect parameters such as bit_rate, rate, width or height

leave a comment »

After successfully ripping the audio from some video files using ffmpeg.exe I suddenly started getting this error message:

Error while opening encoder for output stream #0.0 – maybe incorrect parameters such as bit_rate, rate, width or height

Unfortunately, this is a generic error message that gives little indication of exactly what the problem is. I googled the error but couldn’t find any suggestions that helped. After trying a few things I realised what the problem was – the video files I’d successfully converted had a stereo audio track but the video files it was failing on had a 5.1 audio track as well as stereo. By default, ffmpeg was selecting the multi-channel audio track which, obviously, couldn’t be output to a stereo mp3 file.

The solution is to add the following command line parameter to indicate that ffmpeg should create a two channel output:

-ac 2

So, the complete command is:

ffmpeg.exe -i “video-file.m4v” -vn -acodec libmp3lame -ac 2 -ab 256k “audio-file.mp3”

Written by Sea Monkey

March 24, 2013 at 8:00 pm

Posted in General

Tagged with