LIBFAAC cannot resample channels

2

1

Im using avconv to convert video files into MP4, but whenever I try to encode files with 6 or 8 channels into 2 channels using libfaac I get these error messages:

Can not resample 8 channels @ 44100 Hz to 2 channels @ 44100 Hz

(EDIT: the full output of messages can be found here: http://pastebin.com/UXGrBy1D)

These are the codecs we have installed for avconv: http://pastebin.com/hyQrqXqW

And this is the command I am running:

avconv -y -i input.mp4 -vcodec libx264 -bufsize 20M -maxrate 4000k -threads 12 -same_quant -acodec libfaac -ac 2 -ar 44100 -ab 128k output.mp4

Am I doing something wrong?

Or, is there any alternatives to libfaac which will resample 8 channels into 2 channels?

I need to be able to do this from a command line on my ubuntu 12.04 server.

Jimmery

Posted 2013-01-11T14:37:59.873

Reputation: 440

Well, what the error says: It can't automatically downmix the channels. You might need to do it by extracting the original audio, downmix it with sox or similar and then multiplex that with the encoded video. Can we see your full, uncut command line output from avconv, please? – slhck – 2013-01-11T16:10:37.803

Sure, have a look at my edit. The uncut output is pretty big though! – Jimmery – 2013-01-11T16:34:00.083

Thanks! Could you explain what you need to achieve? File size reduction? Compatibility with some device? As for why -same_quant shouldn't be used, see: sameq does not mean "same quality.

– slhck – 2013-01-11T18:16:59.217

Answers

4

First of all, if you haven't already done so, check out this ffmpeg h.264 encoding guide - it applies to avconv as well, just change every instance of ffmpeg to avconv. Also, consider upgrading to a more recent version of avconv or ffmpeg - since you're on Ubuntu, you could use this PPA, or compile it yourself (this last option will give you access to fdk_aac, which is a much better AAC encoder than FAAC).

Unless you know exactly what you're doing & have a specific reason, you probably shouldn't use -bufsize 20M -maxrate 4000k -threads 12 -same_quant. In fact, going by the input in that pastebin, you should probably just use -codec:v copy, which won't touch the video stream.

As for your stated problem... I don't think libfaac is your problem. Look here (from your pastebin):

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from \'/var/www/up/up50eefce404e4f.mp4\':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2007-12-08 19:28:08
  Duration: 00:46:47.64, start: 0.000000, bitrate: 308 kb/s
    Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16, 111 kb/s
    Metadata:
      creation_time   : 2007-12-08 19:28:08
    Stream #0.1(und): Video: h264 (Baseline), yuv420p, 320x240 [PAR 1:1 DAR 4:3], 195 kb/s, 11.99 fps, 11.99 tbr, 11988 tbn, 23976 tbc
    Metadata:
      creation_time   : 2007-12-08 19:28:11

FFmpeg thinks your input audio is stereo. Much later on:

Input stream #0:0 frame changed from rate:44100 fmt:s16 ch:2 to rate:44100 fmt:s16 ch:8
Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.
Can not resample 8 channels @ 44100 Hz to 2 channels @ 44100 Hz

The video stream is also throwing up a hell of a lot of errors. I suspect that your input may be corrupted.

It's possible that the following command will work:

avconv -ac 8 -i input.mp4 -c:v copy -c:a libfaac -b:a 128k -ac 2 output.mp4

-ac sets the number of audio channels: if the AAC stream isn't corrupted, it's possible that the container format is just providing incorrect data to avconv, and putting -ac 8 before the input overrides the setting provided by the MP4 container (and putting -ac 2 before the output tells ffmpeg to output to 2 audio channels).

evilsoup

Posted 2013-01-11T14:37:59.873

Reputation: 10 085