VideoHelp Forum

+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Hi all - I'm not very advanced on these matters so would appreciate your advice.

    Can anyone suggest a SIMPLE method for me to take a batch of MP4 video files and normalise the audio as the audio levels are different on many of them. I've looked at various posts which seem to say I have to somehow normalise the audio using, for example, Audacity and then reinsert the audio track back into the video file. This is a bit confusing and I have no idea how to do this anyway.

    So, can anyone recommend a program like MP4 Gain (but maybe a free one) that can take a batch of files and normalise them in a simple manner ??
    Alternatively, can you point me to any written or video tutorial that might teach me a step by step way of achieving this??

    Many thanks in advance
    Quote Quote  
  2. The qaac encoder has a normalize feature, which may work fine for your purposes, although I haven't tested it.
    You would also need ffmpeg — to simplify and get it all in one place, both tools are included in MeGUI (although, if I remember correctly, qaac requires an extra download in the form of CoreAudioToolbox).
    With MeGUI decompressed (and provided that qaac has all the required DLL dependencies), a script like this should do the trick (on a Windows system) :
    Code:
    FOR %%F in (*.mp4) DO (
        "C:\path\to\MeGUI\tools\ffmpeg\ffmpeg.exe" -i "%%F" -vn -c:a pcm_s16le -f wav - | "C:\path\to\MeGUI\tools\qaac\qaac.exe" - --normalize -o "%%~nF.m4a"
        "C:\path\to\MeGUI\tools\ffmpeg\ffmpeg.exe" -i "%%F" -i "%%~nF.m4a" -map 0:0 -map 1:0 -c:v copy -c:a copy "%%~nF -- normalized.mp4"
    )
    Replace “path\to\MeGUI” by the actual location of the MeGUI folder (which can be anywhere as it's a so-called “portable” software), copy the above code into Notepad and save it with a .bat extension (instead of .txt), place it in the folder containing the MP4 files, then double-click on it. It may seem more complicated than the fancy GUI program you requested, but once it's set such a script will be much quicker and more convenient to run.
    The result :
    Image
    [Attachment 60826 - Click to enlarge]


    You could add quality settings, but the default settings with qaac produce high quality files, i.e. an average bitrate in the ballpark of 200kb/s (even though every re-compression involves some quality loss, it shouldn't be noticeable).
    The integrated help for qaac (which is obtained by typing “qaac -h”) states regarding the “normalize” option : “Works in two pass[es]. Can generate HUGE tempfile for large piped input.” Not sure what it means / implies exactly — could someone elaborate on this ?


    I just tested and got an unexpected result : the three MP4 files I used in the test had the audio stream identified as “0” (first track) and the video stream identified as “1” (second track), which is unusual but can happen ; so the resulting remuxed files had two audio streams (original audio + processed audio) and no video stream. In this case the second line should be :
    Code:
        "C:\path\to\MeGUI\tools\ffmpeg\ffmpeg.exe" -i "%%F" -i "%%~nF.m4a" -map 0:1 -map 1:0 -c:v copy -c:a copy "%%~nF -- normalized.mp4"
    But if there are mixed files with a different layout being processed, some processed files will end up correct, some not.
    I tried like this :
    Code:
        "C:\path\to\MeGUI\tools\ffmpeg\ffmpeg.exe" -i "%%F" -an -i "%%~nF.m4a" -c:v copy -c:a copy "%%~nF -- normalized.mp4"
    But the resulting files had the original audio, not the processed audio, despite the “-an” option after the first input file. Why is that ?
    Quote Quote  
  3. Thank you very much for replying to my question. I am sure it contains all the info that a knowledgeable person needs. Unfortunately it is way too advanced for the likes of me !! I was hoping that there would be a simple solution like an all-in-one program that could just take the batch of Mp4 files and process them in one click. Obviously, other than MP4Gain, there isn't and I don't even know what demuxing is let alone how to do it.

    However, I am certain you wise information would help someone more advanced than myself. Thanxx again.
    Quote Quote  
  4. use foobar2K replaygain to normalize the audio of your mp4 files.
    Quote Quote  
  5. Member azmoth's Avatar
    Join Date
    Jan 2010
    Location
    Europe.
    Search Comp PM
    Dead easy! Get the last version of mp3Gain 1.3.4 and aacGain 1.9. Rename the aacGain to the .exe of mp3Gain. Extract all your audio whatever format using Pazera Audio Extractor to mp4a. Input either as a collective folder in Mp3Gain or single files and check.

    Then use the Gain to add replay gain to your target or remove any clipping!

    Mux the audio back in using Yamb portable(not the installer!)or just make a MKV usingToolnix!
    Quote Quote  
  6. I know how to use Mp3Gain. Are you saying I need to download a program called aacGain and rename it as Mp3 gain - ?? I'm not clear what you mean. Explain.
    Then do I just import the files and into what? Please explain.
    Lastly (for the amateurs like me, what does it mean " Mux the audio back in using Yamb portable. How do I do this. Again, you're talking to a complete amateur here....
    Quote Quote  
  7. Member azmoth's Avatar
    Join Date
    Jan 2010
    Location
    Europe.
    Search Comp PM
    MP3 Gain 1.3.4 beta version of the GUI is designed to work with AACGain. Download AACGain, rename "AACGain.exe" to "mp3gain.exe", and put it in the MP3Gain folder."

    Then open its GUI and have fun normalizing your audio files. Word of warning it only normalizes audio LC-aac with the m4a extension or .mp4v(I think it does this okay!)or raw .mp4 files as extracted by Yamb. It's useless for he-aac or older aac. By the way you can normalize 5.1 tracks with the mp4a. Extract all your audio with PazeraAudio Extractor and it does this mp4a extraction as default and run it through mp3Gain. So no worries ever again!

    Regarding Yamb there is a portable version from its site. Get it from VideoHelp tools section. Its installer screws up the registry. You can extract audio from any MP4 file as raw as a .mp4 extension file using Yamb, normalize using mp3Gain and pop it back into Yamb for a new remux. You only see these file extensions if you go into Windows settings to show hidden extensions so you can forget this as it's not important. I'd just put your MP4/H264 file into the Mkv Toolnix box instead of using Yamb(so forget it and go easy mkv!)untick the original audio choice and just drop in the normalised newer one and remux(putting the audio with the video-think of it like the old avi interleaving or a/v synching-in a container. Mkv is great, with adding srt too or synching bad audio delays!
    Last edited by azmoth; 20th Sep 2021 at 14:41.
    Quote Quote  



Similar Threads