4

Trying to convert an mkv file to avi:

 avconv -i 1.mkv ./converted/1.avi

Getting this output:

avconv version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav developers
  built on Mar 22 2012 05:29:10 with gcc 4.6.3
[matroska,webm @ 0x8ba3aa0] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from '1.mkv':
  Metadata:
    TITLE           : 
    ARTIST          : 
    COMPOSER        : 
    SYNOPSIS        : 
    DATE_RELEASED   : 
    GENRE           : 
  Duration: 00:07:48.54, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 1910x800 [PAR 1:1 DAR 191:80], 24 fps, 24 tbr, 1k tbn, 180k tbc (default)
    Stream #0.1: Audio: aac, 44100 Hz, stereo, s16 (default)
[buffer @ 0x8dcd160] w:1910 h:800 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 0x8f24540] invalid bit rate
Output #0, avi, to './converted/1.avi':
  Metadata:
    TITLE           : 
    ARTIST          : 
    COMPOSER        : 
    SYNOPSIS        : 
    DATE_RELEASED   : 
    GENRE           : 
    Stream #0.0(eng): Video: mpeg4, yuv420p, 1910x800 [PAR 1:1 DAR 191:80], q=2-31, 200 kb/s, 90k tbn, 24 tbc (default)
    Stream #0.1: Audio: ac3, 44100 Hz, stereo, flt, 200 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (aac -> ac3)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

Google has turned up nothing.

1
  • Sorry, I must have misunderstood that.
    – slhck
    May 21, 2012 at 11:26

1 Answer 1

3

First of all, try using another encoder rather than ac3. With your command, you're basically letting avconv decide on everything by its own. While this may be a bug (please file a report if it works in FFmpeg), you can probably circumvent it by specifying an encoder — I'd suggest MP3 if you have that linked to libav:

avconv -i 1.mkv -c:a libmp3lame ./converted/1.avi

Here's an indication for the error:

Incompatible sample format 's16' for codec 'ac3'

Maybe try forcing AC3 and maybe even specifying parameters like -b:a:

avconv -i 1.mkv -c:a ac3 ./converted/1.avi

You might also want to use proper options for the video stream too, rather than converting a (probably high quality) h.264 stream to plain MPEG-4. I'm pretty sure the result of your conversion will look bad if you don't.

4
  • Thanks for your reply. Got it working with libmp3lame. Thanks for the heads up regarding video options also. Where can I read more about this? The documentation doesn't give much of an overview.
    – sennett
    May 21, 2012 at 11:20
  • I wrote a lot about this, also on the Super User blog: FFmpeg: The ultimate Video and Audio Manipulation Tool. Check the links below that blog entry for some other answers I wrote, which talk about using x264 and setting a good quality level. Do yourself a favor and use x264 instead (-c:v libx264) – quality will be much better than using the basic MPEG-4 encoder. Hope this helps — let me know if you need further info! :)
    – slhck
    May 21, 2012 at 11:26
  • Although one warning: x.264 in AVI containers might not always work that well. Try changing to MP4 containers or stay with MKV. If you need AVI containers, you can stick with MPEG-4, but then specify a quality level: avconv -i 1.mkv -c:v mpeg-4 -qscale 3 …, where qscale can be from 1 (good) to 31 (bad), with sane values being 2-5.
    – slhck
    May 21, 2012 at 11:30
  • Goodness me mate. Thanks so much for all the info. Looking through the blog entry now. Most informative.
    – sennett
    May 21, 2012 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .