Saturday, January 10, 2015

Normalize ac3 in MKV container

A few of my home videos have a really low volume sound. I couldn't find a good solution to achieve a louder video, so I worked out a solution by combining different tools to do the work.

So I start with a MKV container which has video in AVC and audio in AC-3 format. The goal is a new MKV container with audio in AC-3 in a higher volume. For instance the file below (filename AV200011.B,mkv).


I will show the following steps:


1. In VirtualDub with mkv plugin and ac3 decoder extract ac3 audio stream as wav using full processing mode
2. In VirtualDub extract video as avi using direct stream copy
3. In Audacity load wav file and normalize it
4. In Audacity with FFmpeg to new ac3 file
5. In MKVToolNix GUI merge video from step 2 and audio from step 4 to new mkv container


1. Extract audio

First download and install Virtualdub (I used VirtualDub 1.10.4) and install the Matroska plugin by copying the plugin to the plugins32 folder. Then install an ac3 decoder called AC3ACM by running the 'Install the 32-bit codec.bat'. Open VirtualDub and do File|Open video file and load the mkv container.


Do Audio|Full processing mode and leave other options. Now choose File|Save WAV...


2. Extract video
In Virtualdub extract video as avi using direct stream copy. Now choose Audio|No audio and Video|Direct stream copy. File|Save as AVI...



3. Normalize audio
 Download and install Audacity (I used Audacity 2.0.6). Then install FFmpeg. To do this open Audacity and choose Edit|Preferences... and choose Libraries. Click Download and install FFmpeg.


Now in Audacity load wav file and do Effect|Normalize it.
Before:



After:



4. Export wav to ac3
In Audacity with ffmpeg export wav to new ac3 file

5. Remux (merge) MKV
In MKVToolNix GUI merge video from step 2 and audio from step 4 to new mkv container

Done!




No comments: