Thursday, March 22, 2012

drc compressing audio and video avi xvid and divx

dynamic range compression.
notes 3moy2012/ compressing audio and video avi xvid and divx / with linux

reindex to ....>>...a new avi first.

#1::::::::::::
$ nice -n 19 mencoder *.avi -forceidx -oac copy -ovc copy -O 02new-indexOUT.AVI

--------------------------------
################################
## -page1-
## dummy
## @ mplayer -nolirc -msglevel all=1 -quiet "$ifile" -ao pcm:fast:file="$afile" \
## -nocorrect-pts -vc null -vo null
#################################
-----------------------------
#3:::::::::::::::::
-page2-
ac3 to wav\smoke:
$ nice -n 19 mplayer -nolirc \
-ao pcm:fast:file="03x-gain.wav " \
-vc null -vo null \
*.AVI

/**********when nplayer dump fails use ffmpeg copy*************/
#3:::::::::::::::::::::::::
#3::::::::::
#################################################
## dump ac3 6channels to 6channle huge wav file.
## code:
##$ nice -n 19 ffmpeg -i 02*.AVI -vn 03x-gain.wav
###################################################
or
#3::::::::::::::::: to a smaller 2channel wav.
$ nice -n 19 ffmpeg -i 02*.AVI -vn -ac 2 03x-gain.wav


#4:::::::::
on 2channle wav only!
$ nice -n 19 normalize-audio -l 0 --peak -v 03x-gain.wav

/*********normalize may fail on a large file fubar***************/
#4:::::::::::::::::::::
flat default classic music for road trafoc range [-20]db
go strait to drc.
NOTE: sox is slow and does not give feedback by default.
$ sox 03x-gain.wav -t wav 04foo-compression-flat20db.wav compand 0.3,1 6:-70,-60,-20 -5 -90 0.2

#normalize-audio::
$ nice -n 19 normalize-audio -l 0 --peak 04foo-compression-flat20db.wav


#lame:
$ nice -n 19 lame 04foo-compression-flat20db.wav -b 192 --cbr -F -m s -h --noreplaygain 05a-norm.mp3

-------------------------------------------------------------------
//*******************lowder 50db-drc-range FM RADIO range*******/
louder for fm style db rang3 [50]db
SOX:
$ sox 03x-gain.wav -t wav 04foo-compression-fm50db.wav compand 0.3,1 6:-70,-60,-50 -5 -90 0.2

#normalize-audio::
$ nice -n 19 normalize-audio -l 0 --peak 04foo-compression-fm50db.wav

#lame:
$ nice -n 19 lame 04foo-compression-fm50db.wav \
-b 192 --cbr -F -m s -h --noreplaygain 05a-drc-norm-fm50db.mp3

------------------------------------[
Unsupported number of channels: 6
## oops ac3 is evil to transcode.

work around use avidemux. load audio external wav then transcode to mp3 cbr 193bittrate stereo..

#######################################
#########################
###########http://answers.yahoo.com/question/index?qid=20080628232421AAh7EEe
"dynamic band in decibels" is meaningless.
I think you may dynamic range in dB. I don't recall the actual numbers,
but for mono FM is is about 60-70 dB with a fairly good signal.
Stereo drops it to about 50 dB
###############
#############################
####################################
xxxxxxxxxxxx6movie mode:
SOX:
$ nice -n 19 sox 03x-gain.wav \
-t wav 04foo-compression-x6movie-mode-db.wav compand 0.3,1 5:-80,-79,-34 -8 -90 0.2

#normalize-audio::
$ nice -n 19 normalize-audio -l 0 --peak 04foo-compression-x6movie-mode-db.wav

#lame:
$ nice -n 19 lame 04foo-compression-x6movie-mode-db.wav \
-b 192 --cbr -F -m s -h --noreplaygain 05a-drc-nibus6-norm-db.mp3



Dynamic Range Compression

0: Film Light
1: Film Standard #range of -72db
2: Music Light # range of -54db classical
3: Music Standard #range -36db
4: Speech #range -18db
5: None (default)
#############################
base of -90db/5= a range of 18db


http://forum.doom9.org/archive/index.php/t-163823.html

+1 But the SOX command for compression can require a bit of fiddling, but once you find a config that works in your environment, it rarely needs further tinkering ...

Wow, after viewing those graphs you seem to have really nailed it nibus! Would you mind detailing some of the parameters you use?

7ek

I use this template:


sox.exe "%INPUT%" "%INPUT%_%DRC%db.wav" compand 0.3,1 5:-80,-79,-%DRC% -%LIMIT% -90 0.2

Where the variables are defined by the batch file. DRC is the dynamic range,
meaning the smaller the number the more compression is applied
(everything is squeezed into a certain amount of db) and
the limit specifies how much headroom to give sox.
The more headroom the less dynamic range,
but also you have to be careful with too little headroom because of clipping.
I spent a long time tweaking these settings to avoid too much pumping,
but it's still there on higher settings.

Here are the ranges that I have set in my script, from light to heavy:

1 - 54db Range / 3db Limit
2 - 50db Range / 4db Limit
3 - 46db Range / 5db Limit
4 - 42db Range / 6db Limit
5 - 38db Range / 7db Limit
6 - 34db Range / 8db Limit

#4 and 5 work good for action movies, and #2 and 3 work good for dramas or comedies
(generally).

However, sox is only the first part of the process. After sox I send the output
to WaveBooster which boosts it even more.

Here is the whole package if you want to try it out:
http://www.mediafire.com/?lkhrr97p94s4izp

Couple issues: you need to make sure the file you drag into
the command window doesn't have any spaces in it's file path.
Also, WaveBooster only supports 16bit, 44100hz wavs, so in eac3to you need to specify:

-down16, -resampleTo44100