HydrogenAudio

Lossy Audio Compression => Other Lossy Codecs => Topic started by: Makaveli7184 on 2013-04-06 14:33:07

Title: Importing AC3 5.1 In Audacity x FFMPEG
Post by: Makaveli7184 on 2013-04-06 14:33:07
Hello,
I am using Audacity 2.0.0 on Windows 7 64-bit.
I have a multichannel 5.1 AC3 movie track that I am trying to transcode into another format through an external command line encoder. I tried this through Audacity, and it worked fine. Output had a bitrate of 198 kbps (disregard that it's a low bitrate because that's beyond the point). However, when I do the same thing through ffmpeg using the same quality settings, I get a 220 kbps bitrate output stream. Through some tests, I came to the absolute indisputable conclusion that Audacity is applying some filtering to the AC3 input which is leading to this discrepancy, whereas ffmpeg is simply decoding the AC3 untouched. I checked my Audacity options, and I couldn't find anything indicating input filtering of any kind.

Also worth noting:
- Command used in Audacity: external-encoder.exe -quality n -options - "%f"
- Command used in ffmpeg: ffmpeg -i input.ac3 -acodec pcm_s16le -f wav - | external-encoder -quality n -options - output.xxx
- When doing the same experiment using a 2 channels stereo track, the output files from Audacity and ffmpeg were identical.


So my question is what is Audacity doing, and how can I prevent it from doing whatever that is, when loading the AC3 5.1 audio?
Title: Importing AC3 5.1 In Audacity x FFMPEG
Post by: Brazil2 on 2013-04-06 15:05:41
Audacity is applying dither by default, check the Quality tab of the preferences.
Also check if the sample rate hasn't been changed.
Title: Importing AC3 5.1 In Audacity x FFMPEG
Post by: Makaveli7184 on 2013-04-06 15:16:47
Audacity is applying dither by default, check the Quality tab of the preferences.
Also check if the sample rate hasn't been changed.

Wow, that was a quicker response then I got in Audacity forums, and yes, it's true: dither was on, turned it off, and outputs now match. Only remaining question is what is dither, and do I need it or should I turn it off? Also, why was it being applied only on 5.1 audio (granted my 2 channels stereo test file is a song, which is much different than a movie track, but still...)?



Also, for future reference, this had nothing to do with AC3 input. I got my hands on a WAV 5.1 sample, and same thing happened: Audacity vs ffmpeg = different outputs with dither on, same outputs with dither off.
Title: Importing AC3 5.1 In Audacity x FFMPEG
Post by: Makaveli7184 on 2013-04-06 15:43:57
OK, I read the Audacity wiki regarding "dither", and I still have some questions:

- How could "dithering" lead to input needing a lower bitrate when encoding in VBR mode if it's harmless? Wouldn't that be the equivalent of smoothing out a picture or video before compressing?

- Wiki states that Audacity does its calculations in 32-bit float, and so when working with 16-bit or 24-bit input, it's best to use dither for better accuracy when rounding. My question is: can I set Audacity to use 16-bit calculations internally when I know beforehand that I will be working on 16-bit input, as to avoid this whole rounding in the first place? If yes, is this what the "Default sample format" option is in the Quality tab??

- Wiki also states that when working on 16-bit audio with simple editing (cut, paste, trim...) rather than processing (amplifying, equalizing, filtering...), then it's better not to use dither on exporting output. My question is: when downmixing 5.1 to stereo, I usually use a -3db gain on the Center and LFE channels. Is this considered "processing" and thus would be needing "dithering"?
(This question is really moot if I can set Audacity to do its internal calculations in the same bit depth as my input material, as I prefer the less accurate calculations then the whole rounding + random noise thing).
Title: Importing AC3 5.1 In Audacity x FFMPEG
Post by: Brazil2 on 2013-04-07 08:00:42
I hope this post will help you a bit:
http://forum.audacityteam.org/viewtopic.ph...=164356#p164356 (http://forum.audacityteam.org/viewtopic.php?f=16&t=62355&p=164356#p164356)