[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: normalize audio in mp4s



Quoting David Wright (2020-03-07 04:56:05)
> On Fri 06 Mar 2020 at 20:33:48 (+0100), Emanuel Berg wrote:
> > how can I normalize the audio in mp4 video files? both WRT not
> > having to lower the volume when there's a firefight and raise it
> > when they start talking again, _and_ WRT playing several files, e.g.
> > music videos, and having them have basically the same volume?
> > 
> > if need be, I can set volume modifications to each file, manually if
> > I knew how to do it. this wouldn't work for firefight/talk
> > movies tho.
> 
> I use the compand and gain effects in sox,
[...]
> The critical lines (embedded in a load of shell) are
>   ffmpeg -hide_banner -y -i "$1" -ar 44100 -ac 2 "$Unique0/$Filenumber.wav"
> where the $Filenumbers are 10000+ sequence numbers so they collate,
>   sox "$Unique0"/1*.wav -t wav -r 44100 -b 16 -c 2 "$Unique0/0.wav" compand 0.3,1 6:-70,-60,-20 -15 -90 0.2 gain -n -0.01;
> where the companding parameters are reasonably aggressive and the
> normalisation is "turned up to ten", and
>   lame -b "${Fixedbitrate:-128}" "$Unique0/0.wav" "$Unique0/0.mp3"
> is for fairly unendowed MP3 players.
[...]
> I would be interested if someone worked out how to do splitting, sox, 
> and recombining reliably enough to preserve the synchronisation. 
> (Automatic, but not on the fly.)

ffmpeg should be able to do the whole processing, if you want peak or 
RMS normalization.  If you want EBU R128 normalization then you need 
e.g. melt (which uses ffmpeg internally and adds aditional plugins).

Here is a good explanation on the difference between "peak", "RMS", and 
"EBU R-128": https://www.learndigitalaudio.com/normalize-audio

Hhere are some example of using ffmpeg: 
https://superuser.com/questions/323119/how-can-i-normalize-audio-using-ffmpeg

I use melt because I can then handle video as well - either do various 
compression of that as well, or "just" pass-through (which still 
involves the challenge of keeping audio and video in sync - which is 
more or less reliable depending on the container format of each video).


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

Attachment: signature.asc
Description: signature


Reply to: