level MP4 audio volume without re-encoding?

Discussion in 'Software' started by EddieXx, Oct 8, 2022.

  1. EddieXx

    EddieXx Audiosexual

    Joined:
    Sep 13, 2015
    Messages:
    1,316
    Likes Received:
    761
    Hi guys,

    i need to level the volume of my music videos library, not necessarily normalize the individual files but level the volume between them. they have very different volumes as now. But i dont want to re-encode the files and loose quality. Is that even possible?

    I mean I get that it may be possible to edit the audio track without re-encoding the video! but as soon as you are editing the audio, if its a compressed file as AAC it must get rencoded right?

    I read about this Mp4Gain app, it says it does just that, no re-encoding, but you know...

    Anyone with some experience in this? who knows if its doable
     
    Last edited: Oct 8, 2022
  2.  
  3. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,122
    Likes Received:
    836
    These *gain tools add a metadata value and leave your original audio stream untouched (no re-encoding).

    The metadata value tells your player software to apply a (static!) gain offset when re-playing the file so it can match a pre-defined LUFS. Not every audio/video player will respect this value. Most do though.

    I've never had to do this for videos and I don't know if mp4gain can handle files with more than one stream (audio + video).

    I'd try with foobar2000, but make backups first.

    upload_2022-10-8_19-11-14.png
     
  4. EddieXx

    EddieXx Audiosexual

    Joined:
    Sep 13, 2015
    Messages:
    1,316
    Likes Received:
    761
    oh, interesting. thanks @xorome , so then its partially doable. meaning a player has to be able to read the added info. I wonder if a tv or plex will read that info. Ill check foobar

    edit: i tested foobar and it corrects the volume by adding a tag for the player to read, but, it didn't work for streaming to a tv. The tv doesn't read tags, it simply plays the raw file stream. so for that you have to re-encode as far as i know

    but, maybe all is not lost because. There is this discussion here where it states that MP3gain for instance doesn't re-encode "much" of the audio file, just enough "just some bits"?! maybe its just bollocks but interesting if its actually so..

    -----------------
    • And you're sure aacgain doesn't recode?
      einpoklum
      May 9 at 12:49

    • I believe it does not reencode. Mp3gain adjusts some "gain" settings within the mp3 frames and from what I know aacgain is the same. It does modify the file, but it is not the same as transcoding where you decode the entire audio data and reencode it. Technically the audio data is exactly the same, it is just a "multiplier" on the data output that gets adjusted with the effect of increasing the volume of the output.
      Mokubai
      May 9 at 13:05


    • @einpoklum I've written about mp3gain and how it works here and I believe aacgain functions in a very similar fashion. in theory if you know the gain values applied you should be able to losslessly adjust volume up and back to the original value. in theory. At a minimum the aacgain tool website i linked states it is based on mp3gain and functions in the same fashion. "It works by modifying the global_gain fields in the aac samples"
      Mokubai
      May 9 at 13:12


    • Ok... although I'm not sure why all this qualification. You could probably tell it re-encoded, since that takes time.
      einpoklum
      May 9 at 13:31

    • It does not re-encode, the time taken is only that needed to read the file, work out "how loud" it is, then to run through the file data to adjust a few bytes every couple of kilobytes and then re-write the file. The "qualification" is an explanation of the method. There is some processing to work out loudness, but no real change to the actual data. Technically the file is not the same, but the changes are largely trivial compared to fully re-encoding the audio data "the hard way".
      Mokubai
      May 9 at 13:59

    (https://superuser.com/questions/172...udio-gain-in-a-matroksa-file-without-recoding)
     
    Last edited: Oct 9, 2022
  5. Xupito

    Xupito Audiosexual

    Joined:
    Jan 21, 2012
    Messages:
    7,231
    Likes Received:
    3,995
    Location:
    Europe
    Haven't tested it yet but this seems the king of lossless/no-re-encoding modifications to mp4 files:
    https://www.3delite.hu/MP4 Stream Editor/index.html
    The process for changing the volume must be similar to the one @xorome mentioned for mkv files. Changing some meta/info/tag,


    Quoted:
    "MP4 Stream Editor is an MP3/MP4 cutter/splitter/joiner/editor, and multi channel audio file editor ...
    Main advantage over other audio editors is that you edit (MPEG - MP4, MP3, MP2; Ogg Vorbis, Opus, DSD DSF and DFF) files without decoding (without loosing quality), graphicaly on a 3D sample display easely with a mouse.
    Multi channel AAC, MP4, Flac, Ogg Vorbis, Opus, etc. audio files are also supported for editing though they are decoded.
    Cut, copy, paste, paste mix, insert silence, change selection volume, apply DSP and VST DSP plugin effects."
     
    • Like Like x 1
    • Useful Useful x 1
    • List
  6. EddieXx

    EddieXx Audiosexual

    Joined:
    Sep 13, 2015
    Messages:
    1,316
    Likes Received:
    761

    thanks @Xupito , ill check it out. When i think of it many years ago i remember there was an mp3 program that could actually edit mp3s and put them back together without re-enconding. i remember it was a bit unstable but shows you can "partially" edit some lossy files without re-encoding them. In this case im only interested in leveling the volume so maybe it can be done
     
  7. Xupito

    Xupito Audiosexual

    Joined:
    Jan 21, 2012
    Messages:
    7,231
    Likes Received:
    3,995
    Location:
    Europe
    Indeed, and it's a mystery to me why there aren't more audio/video programs that can' t do that. Because it's not trivial but way easier than many operations you can do with most viewers/editors.

    BTW, the same happens with lossy encoded jpeg images. You can rotate, crop them and resave without reencoding but only with a certain precision. You can modify also some metadata, don't remember if the brightness included, that standard is old as fuck.
     
Loading...
Similar Threads - level audio volume Forum Date
HSS Guitar audio levels for recording Mixing and Mastering Nov 4, 2021
Black Rooster Audio VLA-FET (Vintage FET Leveling Amplifier) Software News Jun 14, 2019
how to level the amp connected in my audio interface Software Jul 3, 2017
anyone help me with audio levels for production Working with Sound Mar 25, 2016
Jünger Audio & Flux announce Level Magic plugin Software News Jan 23, 2015
Loading...