How to normalize audio in a bunch of videos

I have some experience in audio processing, not professionally, but as a hobby. However, I always approach this topic with full responsibility. Currently, I am learning the German language, and one of the programs I use includes short video recordings with correct pronunciation of words and phrases by native speakers. I noticed that these videos have a significant difference in volume. With my experience in sound engineering and knowledge of audio standards and how sound is perceived by humans, I decided to find an effective solution to this issue. Now, I am sharing my experience with the community in the hope that it will be useful to someone.

After conducting some research, I came across the FFmpeg library, which offers capabilities for video file processing. On the library's website, I found an article explaining how audio can be processed automatically without affecting the video stream. To achieve this, they recommend using the open-source Python program called "ffmpeg-normalization".

Disclaimer: I am not affiliated with the development team of this software.

This program utilizes the EBU R128 standard, which is widely recognized for its effectiveness in achieving balanced and consistent audio levels across various media platforms.

The EBU R128 standard, established by the European Broadcasting Union, aims to ensure consistent and balanced loudness levels in audio content. It utilizes Loudness Units Full Scale (LUFS) to measure audio volume, providing a more accurate and perceptually balanced loudness perception. LUFS provides a standardized way of measuring and comparing audio loudness levels, taking into account the characteristics of human hearing. In accordance with the EBU R128 standard, the accepted loudness level is "-23 LUFS".

Steps to solve the issue

1. Install a recent version of ffmpeg (https://ffmpeg.org/download.html)
2. Install Python (https://www.python.org/downloads/)
3. Install ffmpeg-normalize using Python, to do this - run in the command line:
    `pip3 install ffmpeg-normalize`
4. Process normalization over the video files.

Process normalization over the video files

For example, process only one file:

ffmpeg-normalize input.mp4 --audio-codec aac --output output.mp4
or shorter version:
ffmpeg-normalize input.mp4 -c:a aac -o output.mp4

 Option "--audio-codec aac" is mandatory to process the mp4 files.

This command will process input.mp4 file, normalizing the audio track according to the EBU R128 standard, and write the result to the output.mp4 file. The software processes audio only, leaving the video unchanged.

If you want, you can specify the output audio bitrate using the option "--audio-bitrate" or shorter: "-b:a":

ffmpeg-normalize input.mp4 -c:a aac -b:a 192k -o output.mp4

To process a bunch of files, you can use any solution. I am providing you with an example of how to do it using the Windows command line:

for %i in (path_to_the_files\*.mp4) do ffmpeg-normalize "%i" -c:a aac -o %~dpi..\normalized\%~nxi
where:

  • %~dpi - is a programmatically taken path to the current file
  • %~nxi - is a programmatically taken current file name without path

For example, all files are in a directory:

D:\videos\

run:

for %i in (D:\videos\*.mp4) do ffmpeg-normalize "%i" -c:a aac -o %~dpi..\normalized\%~nxi

so all the videos will be processed and the result will be placed in the directory:

D:\videos\..\normalized\
which also means:
D:\normalized\

Links

No comments:

Post a Comment

Desperate Housewives Susan's Art s05 e16

Desperate Housewives Susan's Art s05 e16