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).
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 fromavconv
, please? – slhck – 2013-01-11T16:10:37.803Sure, 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
– slhck – 2013-01-11T18:16:59.217-same_quant
shouldn't be used, see: sameq does not mean "same quality.