Skip to main content

Topic: using aacgain to modify volume of m4v videos (Read 6715 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • timcupery
  • [*][*][*][*][*]
using aacgain to modify volume of m4v videos
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
God kills a kitten every time you encode with CBR 320

  • davelasker
  • [*][*][*]
using aacgain to modify volume of m4v videos
Reply #1
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...

  • davelasker
  • [*][*][*]
using aacgain to modify volume of m4v videos
Reply #2
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
  • Last Edit: 17 September, 2012, 08:38:01 PM by davelasker

  • timcupery
  • [*][*][*][*][*]
using aacgain to modify volume of m4v videos
Reply #3
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.
  • Last Edit: 20 September, 2012, 01:00:14 AM by timcupery
God kills a kitten every time you encode with CBR 320