News:

--

Main Menu

mp4 batch normalization with Avidemux

Started by flash_22, July 08, 2016, 04:43:38 AM

Previous topic - Next topic

flash_22

hello,
I constructed a batch file to normalize the audio of many mp4-Video-files.
I want to normalize the audio of each file in order to get them to be of the same loudness.
After the normalization process all mp4-Video-files should be of the same loudness.

The audio should be processed (normalized).
The video should be just copied (left unchanged) ----> set videocodec=Copy

I've got 2 problems:
first, the file format is double ---> my file is named e.g. something.mp4.mp4

second, I'm not sure if the normalization is working properly... I created a test file with low audio and tried to increase it by normalization - but I failed.

Here is the Code:

set avidemux="C:\Program Files\Avidemux\avidemux.exe"
set videocodec=Copy
set audiocodec=AAC
set audiobitrate=192
set outputformat=MP4
set normalize=true
for %%f in (*.mp4) do %avidemux% --output-format %outputformat% --video-codec %videocodec% --audio-normalize --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --force-alt-h264 --load "%%f" --save "%%f.mp4" --quit

Please be so kind and help me!!

yours sincerely...

Please don't bother of my bad english (I'm not a native speaker)



Jan Gruuthuse

#1
set avidemux="C:\Program Files\Avidemux\avidemux.exe"
for %%f in (*.avi) do %avidemux% --load "%%f" --run "AACauto-normalize-mp4.py" --save "%%f.mp4" --quit

have attached tinypy script "AACauto-normalize-mp4.py" in folder with the to processed videos. Or add path where the tinypy script is located to the "AACauto-normalize-mp4"

see if this works

flash_22

Hello Jan Gruuthuse,
thanks a lot for your help!!

Unfortunately, the script does not increase the loudness of my test-File (the one with low audio volume) by the normalization process.

I  ran your batch file with the python code in the same folder with the to processed mp4s - it didn't had the desired effect.
Then I modified your batch script and ran it again without the desired effect.

here is the code:

set avidemux="C:\Program Files\Avidemux\avidemux.exe"
set videocodec=Copy
set audiocodec=AAC
set audiobitrate=192
set outputformat=MP4
for %%f in (*.mp4) do %avidemux% --load "%%f" --run "AACauto-normalize-mp4.py" --save "%%f.mp4" --quit

But I think this doesn't fit to your python code:

set videocodec=Copy
set audiocodec=AAC
set audiobitrate=192
set outputformat=MP4

I looked into "AACauto-normalize-mp4.py" but I don't have a clue.
I compared the properties of my test-file with those of the processed file and I realised that:

The frames per second changed from 25 to 24.
The (Video)bitrate changed from about 5000 to about 1000.

Please, would you be so kind and perhaps help me about:

How can I realize these settings:
set videocodec=Copy
set audiocodec=AAC
set audiobitrate=192
set outputformat=MP4

Have you an idea how I can prevent the change of the frames and the (video)bitrate?

I don't want to annoy you with these questions...

It is a hobby of me to edit my mp4-files and the last step would be to get them all normalized...

It would be great if you can give me a hint how I get them auto-normalized...

Greetings, flash_22

Jan Gruuthuse

If you're not running the latest avidemux 2.6.12 nightly that could explain. load the 32 or 64 bit windows version here: http://www.avidemux.org/nightly/ (July 7 2016)
Make sure your running the GUI and not CLI (command line)
Load your video in to the latest avidemux, make your settings as you're are used to.
And in Avidemux Menu: File: Project Script: Save As Project then edit the save .py project file:
Delete only between this lines:
adm = Avidemux()
and
adm.videoCodec("Copy")
save your project and use the saved filename.py in your batch file



flash_22

Hi Jan Gruuthuse,
perfectly, with your help I managed it!!
You made my day!!
Now the Normalization works properly!!

Now I got 2 simple questions:

1)
I still got the problem of the double file extension.
My processed files have got names like:
something.mp4.mp4
I guess in my batch is something wrong about "mp4".
But I don't see the mistake...

2)
To differentiate between "original" and "normalized" files, do you know how to add an additional part like:
"something-norm.mp4" ?

Here is my Code:

My Batch:
set avidemux="C:\Program Files\Avidemux\avidemux.exe"
for %%f in (*.mp4) do %avidemux% --load "%%f" --run "mp4s-normalisieren.py" --save "%%f.mp4" --quit

and my Python-Script:
named "mp4s-normalisieren.py"

adm = Avidemux()
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "LavAAC", "bitrate=192");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.audioSetNormalize(0, 1, 10)
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=False")

Could you give me a hint about the double file extension and perhaps about how to add the additional part "-norm" to the files - so they would have the name "something-norm.mp4"?

The difficulty of the normalization is managed and I would be very thankful if you have a hint how to get managed the 2 little remaining questions.

I wish you a pleasant day...

Greetings, flash_22



mean

for %%f in (*.mp4) do %avidemux% --load "%%f" --run "mp4s-normalisieren.py" --save "normalized%%f" --quit

flash_22

hello mean,

I just got the same:

set avidemux="C:\Program Files\Avidemux\avidemux.exe"
for %%f in (*.mp4) do %avidemux% --load "%%f" --run "mp4s-normalisieren.py" --save norm-%%f --quit

flash_22

Hi Jan Gruuthuse and mean,

thanks a lot for help!!

Now all my questions are answered!!

Greetings, flash_22

flash_22

Hi, Normalization of mp4-videos works great.
But I'm wondering what avidemux is doing when it normalizes the stereo track of my mp4-videos?
Do you know if the 2 stereo tracks are balanced and then normalized? Or is each track individually normalized?
I couldn't find any information...

For any help I will be very thankful!!

Greetings, flash_22

Jan Gruuthuse

Most likely you need to apply on each track via Avidemux Menu:
Audio: Select Track: Audio Tracks configuration:
Track 1 [v] [Filters]
Track 2 [v] [Filters]
Track 3 [v] [Filters]
Track 4 [v] [Filters]
Test with small part of video and compare each track if this did work.