VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Jul 2018
    Location
    Midwest
    Search Comp PM
    Hi,
    I have a lot of TV series on .AVI format and the audio codec is .mp3. I'm batch converting them by copying the video, and encoding using mp3 to get all files to 89db. It works great and is a decently quick process but my question is this: When you have a bunch of files and you want to level the audio on them, does it matter which audio codec you use to re-encode the audio? I only see 4 audio codecs total on xmedia recode.
    Quote Quote  
  2. Yes. Codec choice is important for quality/efficiency and compatibility. But mp3 is a good choice for AVI, IMHO.

    Note that your current process is lossy because it first decompresses the audio, then applies a normalization filter and as a last step encodes again to mp3. There is a software called "mp3gain" which can losslessly alter the volume of mp3 files.
    Quote Quote  
  3. Member
    Join Date
    Jul 2018
    Location
    Midwest
    Search Comp PM
    Thanks and yes I know about mp3gain, but you can't use mp3gain for video files. I know about mp4 gain, but that isn't compatible with some codecs. I've found this to be the easiest but when I updated xmedia recode the other day, in the list of audio codecs, there is no mp3 anymore. It made me wonder what I should choose when volume normalizing video files that contain mp3 as the audio. Oh and I understand it's lossy but I couldn't tell any difference after the process so I was ok with it.
    Quote Quote  
  4. Originally Posted by MarkVS View Post
    I know about mp3gain, but you can't use mp3gain for video files.
    There's a batch file in these forums that can do that. Demux the audio, run mp3gain, mux the new audio with the original video.

    https://forum.videohelp.com/threads/255147-Mini-Guide-Normalizing-Audio-for-Multiple-AVI-files
    Last edited by jagabo; 11th Jul 2018 at 10:55.
    Quote Quote  
  5. Member
    Join Date
    Jul 2018
    Location
    Midwest
    Search Comp PM
    thanks so much
    too bad that's only for AVI files....I have so many different formats. This would work on some of them, but no all.
    Quote Quote  
  6. Your first post only mentioned AVI files. The batch file could easily be modified for other containers.
    Quote Quote  
  7. I don't use AVI in a long time, I like the wavi and the wavegain/wavegainS tool because it not just adjust the gain but fix the DC Offset also.
    Command line:
    Code:
    wavegain -l -f audio.log -y AUDIO.wav 
    
     Analyzing...
    
        Gain   |  Peak  | Scale | New Peak |Left DC|Right DC| Track
               |        |       |          |Offset | Offset |
     --------------------------------------------------------------
      +2.64 dB |  12929 |  1.36 |    17521 |    0  |     0  | AUDIO.wav
    
     Applying Gain of +2.64 dB to file: AUDIO.wav
    
     WaveGain Processing completed normally
    This is the way I extract, adjust the gain and convert the audio using a .bat file.
    Code:
    :: Extract the Audio
    wavi.exe some_script.avs AUDIO.wav
    
    :: Calculate, fix DC offset if any, apply the calculated gain
    wavegain -l -y AUDIO.wav
    
    :: Convert to AAC format
    :: --text-codepage 65001 = UTF=8
    qaac\qaac.exe --threading --verbose --genre TV --text-codepage 65001 -V 118 -q 2 AUDIO.wav -o AUDIO.m4a
    
    :: Not needed anymore
    del AUDIO.wav
    Then is just a matter to adapt for multi files using those "for" loops to process files like:
    Code:
    for %i in (someplace\*.wav) do wavegain -l -y "%~ni.wav"
    Or something like that, this is just an overall but you get the idea.
    Quote Quote  
  8. foobar2000 can scan with ReplayGain and adjust MP3 and AAC volume losslessly, but unlike MP3Gain it'll do it when the audio is in an MKV or MP4. I haven't tried AVIs so I don't know if you need to extract the audio from them first, but for MKV/MP4 it doesn't matter if they contain video and there's no need to extract the audio. It's still called ReplayGain scanning, but fb2k uses the newer R128 algorithm. It seems a tad better than the old ReplayGain method.
    fb2k can also re-encode the audio while apply ReplayGain, if you need to do it that way, and while it's encoder configuration is quite versatile (I use it for nearly all of my audio encoding) you'd have to combine the video and the encoded audio yourself (fb2k is an audio player, after-all).

    Note: There's no "undo" option whem adjusting MP3 or AAC losslessly, as fb2k doesn't write the required info to tags as MP3Gain does, and it's not as user-friendly in respect to what it displays. There's no info to indicate clipping after changing the volume (MP3Gain displays red when it'll cause clipping and it changes accordingly if you adjust the target volume), so it pays to check the peak levels yourself after adjusting the volume, but fb2k can do true peak scanning if you're into that sort of thing, it'll scan multiple files at a time, and it's scanner is at least 1000x faster than MP3Gain.

    As a rule of thumb, I use a target volume of 89dB for standard music tracks, and 83dB for soundtrack audio, as the latter tends to be more dynamic and needs more headroom. 83dB is the official target volume for soundtrack audio anyway, at least in Europe (or a volume of -23 LUFS in R128 lingo, given the way the ReplayGain volume is specified is fairly retarded). https://tech.ebu.ch/loudness/
    Last edited by hello_hello; 18th Jul 2018 at 09:02.
    Quote Quote  
  9. When metadata are used to adjust level there is high risk that this metadata can be ignored - only using physical volume normalization you can be sure about final results.
    There is also another important problem - volume (level) normalization vs. loudness normalization (i.e. perceived level). Metadata can't address loudness normalization unless whole signal chain is designed with this on mind.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!