HydrogenAudio

Lossy Audio Compression => AAC => AAC - General => Topic started by: timcupery on 2012-09-17 21:49:29

Title: using aacgain to modify volume of m4v videos
Post by: timcupery on 2012-09-17 21:49:29
When I encode DVD movies to mp4/m4v (h264 video and aac audio) using Handbrake, I then change the file extension to .m4a and replaygain-scan the audio stream. I can do the scanning in either foobar2000 or AACgain (the modified MP3gain variant which can also adjust frame-by-frame volume on aac files). Sometimes there is substantial clipping in the audio stream (with peak values of 1.5 or 1.6), and in such cases I can use AACgain to decrease the volume of the audio stream, before manually changing the file extension back to .m4v or .mp4

The problem I have noticed recently is that AACgain is unable to read some large files. foobar2000 will recognize all of these files with a .m4a extension and can scan replaygain and write tags. But for some movie files, AACgain hangs for a few seconds (apparently trying to read the file) and eventually shows the file but not any RG information that was already in the tags, and AACgain is unable to modify the gain of the file.

This has only happened once I started using Handbrake's "high quality" preset to encode movies; when using the "normal" preset, AACgain was able to recognize and modify gain on all movie files.
This may be a filesize issue (e.g., AACgain cannot handle files that are larger than 1gb) or have something to do with another setting in Handbrake's "high quality" preset.

Any ideas what is going on here? I am using AACgain 1.9
Title: using aacgain to modify volume of m4v videos
Post by: davelasker on 2012-09-17 23:19:46
The problem I have noticed recently is that AACgain is unable to read some large files. foobar2000 will recognize all of these files with a .m4a extension and can scan replaygain and write tags. But for some movie files, AACgain hangs for a few seconds (apparently trying to read the file) and eventually shows the file but not any RG information that was already in the tags, and AACgain is unable to modify the gain of the file.

This has only happened once I started using Handbrake's "high quality" preset to encode movies; when using the "normal" preset, AACgain was able to recognize and modify gain on all movie files.

I am the author of aacgain, and I also use Handbrake. I'll see if I can duplicate your problem. Stay tuned...
Title: using aacgain to modify volume of m4v videos
Post by: davelasker on 2012-09-18 01:32:44
I am the author of aacgain, and I also use Handbrake. I'll see if I can duplicate your problem. Stay tuned...

I see the problem.

Start Handbrake and open one of your movies. Make sure you are looking at a modern movie with surround sound. Click the "Audio" tab in Handbrake. Now switch between the "Normal" and "High Profile" presets. You will see that with "Normal", there is a single AAC audio track. But with "High Profile", Handbrake adds an additional AC3 passthrough audio track.

Unfortunately, aacgain can only process files with a single audio track. If you run aacgain manually from the command line on the "High Profile" endcoded MP4, you will see the message "Error: File must contain a single audio track."

To fix the problem, configure Handbrake to set the AC3 Passthru audio track to "None". aacgain is unable to process AC3, only aac so make sure the one remaining audio track in your Handbrake configuration is AAC.

Depending on how much headroom is in the aac decoder used in your player, there may not be any distortion introduced by the clipping, so you might not have to worry about it. You can also use the "Gain" and "DRC" adjustments in the Handbrake Audio panel to control the clipping, thus eliminating the need to run aacgain after encoding.

I find that most movie soundtracks have too much dynamic range for my liking, and, except for the loudest parts, are much too quiet. So I normally set my Handbrake gain to +5, and DRC to 2.5. This gives me reasonable volume overall with minimal clipping. Experiment with these adjustments to see what works best for you.

Hope that helps...

Dave
Title: using aacgain to modify volume of m4v videos
Post by: timcupery on 2012-09-20 05:59:54
I see the problem. Start Handbrake and open one of your movies. Make sure you are looking at a modern movie with surround sound. Click the "Audio" tab in Handbrake. Now switch between the "Normal" and "High Profile" presets. You will see that with "Normal", there is a single AAC audio track. But with "High Profile", Handbrake adds an additional AC3 passthrough audio track.

Great, very helpful, thanks Dave!
For stuff I've already encoded I can use a muxing program to remove the AC3 stream.

Also, thanks for the tip on compression of dynamic range.