I am using ffmpeg on a Windows 7 machine. I am trying to convert mkv files to either mp4 or avi. Here is the command I used:

ffmpeg -i "C:\Path\To\Input.mkv" "C:\Path\To\Output.avi"

Here is the error I get:

[libmp4lame @ 00000000004624800] Invalid number of channels 6, must be <=2

and after a few lines about what my output file should have been I get this error:

Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

I didn't specify any of those parameters because I wanted ffmpeg to copy them over from the source file. What am I doing wrong and how do I fix it?

  • Please edit your question and post the full output of your FFmpeg command.
    – slhck
    Dec 25 '11 at 11:27
  • I did this in windows from the dos prompt which doesn't allow you to copy output, and there are waaaaaaaaaaay too many lines for me to copy the full output here.
    – aamiri
    Dec 27 '11 at 15:40
  • Of course it's possible: howtogeek.com/howto/windows-vista/…
    – slhck
    Dec 27 '11 at 15:51

Without you posting the full output I can only assume things here, but it's most likely the following issue:

Your MKV file contains 6-channel surround sound. When converting it to AVI, FFmpeg assumes some default codecs for both video and audio. I guess in your case this will be MPEG-4 video and MP3 or MP4 audio.

Anyway, there's no way to get 6-channel sound in LAME MP3, therefore you can try either of the following:

  • This will try and copy the AC3 (or whatever it is) stream.

    ffmpeg -i "C:\Path\To\Input.mkv" -acodec copy "C:\Path\To\Output.avi"
  • This will try and downsample to two audio channels:

    ffmpeg -i "C:\Path\To\Input.mkv" -acodec libmp3lame -ac 2 "C:\Path\To\Output.avi"

I'm actually quite confident that the error message should say libmp3lame and not libmp4name. Please copy/paste output instead of just typing it, and always supply full output.

  • I don't know how to (or if it's even possible) to copy text from the dos prompt.
    – aamiri
    Dec 27 '11 at 15:41

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.