VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. I want to use compand to adjust audio so the low volumes are higher and high volumes are lower, within a reasonable range.

    Im NOT an audio filter guru and even pouring though Sox's docs, I dont fully understand what is going on enough to make my own changes.

    Id like to re-code DVDs and BDs to have an audio track that I can hear well all lower volume stuff, but wont blow out my speakers during an explosion or gunshot, etc..

    What suggestions do you have please?

    I am currently toying with the following (because its what I found via Google), it "seams" to work, but Im open to suggestions.


    compand=0 0:1 1:-90/-900 -70/-70 -21/-21 0/-15:0.01:12:0:0





    Here is the Sox argument I used in another "normalization" project, it worked "pretty good" but Im not sure how to change it to FFMPEG's syntax:
    sox audio.wav audio-sox.wav compand 0.3,1 6:-70,-60,-20 -5 -90 0.2




    Thanks for any assistance,
    VGD
    Quote Quote  
  2. you can run ffmpeg command line where audio input can be sox output, it was recently explored in this thread: https://forum.videohelp.com/threads/365050-AAC-Gain-Normalizing-to-0dB-Muxing-with-FFmpeg
    Quote Quote  
  3. Ahh... I neglected to mention Im running Win32. Sorry.
    Quote Quote  
  4. Can someone assist me understanding/learning how to use a compand argument that was written for SoX and convert it to use in FFMPEG?

    I copy and pasted one that worked for me directly under SoX, but FFMPEG didnt know what to do with it.

    Andrew
    Quote Quote  
  5. it's in that thread I posted, cmd line contributed by Selur , the way it is done, you do not pass sox argument but you pass sox output instead, it is called piping, example from that thread adding your compand arguments to get ac3 for example:

    Code:
    ffmpeg -i audio.wav -f sox - | sox -t sox - -b 16 -t sox - compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 | ffmpeg -y -f sox -i - -b:a 192k audio.ac3
    or
    you just run two commands one after each other or do both commands at once using BAT file , first get audio-sox.wav and then do something with ffmpeg, like: ffmpeg -y -i audio-sox.wav -b:a 192k audio.ac3
    Quote Quote  
  6. for ffmpeg (stereo) this syntax is OK : compand='.13|.13:.35|.35:-70/-35|-35/-20|-20/-15|-15/-15:6:-3.01:-90:0.2'
    Quote Quote  
  7. Thank you very much, I will try and digest the information given for better understanding before I ask further questions, your help is greatly appreciated!

    Andrew
    Quote Quote  
  8. -af "aformat=channel_layouts=stereo, compand=0 0:1 1:-90/-900 -70/-70 -30/-9 0/-3:6:0:0:0"

    Translation: Audio filter, stereo (forces mono -> stereo, just in case) , compander (compressor/expander), attack 0, release 1,

    -90 dB in, infinity out, -70 dB in, -70 dB out, -30 dB in, -9 dB out, 0 dB in, -3 dB out,

    soft knee 6, 0 dB makeup gain, input level 0 dB, lookahead 0.

    Specifically made for 'whisper+explosion' scenes (personal recipe).
    Quote Quote  
  9. Member
    Join Date
    Oct 2008
    Location
    Australia
    Search Comp PM
    Originally Posted by tugshank View Post
    -af "aformat=channel_layouts=stereo, compand=0 0:1 1:-90/-900 -70/-70 -30/-9 0/-3:6:0:0:0"

    Translation: Audio filter, stereo (forces mono -> stereo, just in case) , compander (compressor/expander), attack 0, release 1,

    -90 dB in, infinity out, -70 dB in, -70 dB out, -30 dB in, -9 dB out, 0 dB in, -3 dB out,

    soft knee 6, 0 dB makeup gain, input level 0 dB, lookahead 0.

    Specifically made for 'whisper+explosion' scenes (personal recipe).
    Tugshank, thanks for posting your 'personal recipe', as after having been trying to achieve
    a decent setting for ages with compand, I was almost ready to quit, but alas this works
    fantastic and does exactly as described.
    Many Thanks Sir.
    Quote Quote  
  10. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Moving you to our audio forum section.
    Quote Quote  
  11. I know Im doing CPR on an old thread, somehow I missed the recipe that tugshank posted... I revisited just today (10/12/2017!) and saw the update, the formula is working GREAT!

    Here is my command line..
    ffmpeg_x64 -i "source.mp4" -c:v libx264 -tune film -crf 20 -filter:v hqdn3d -x264opts vbv-bufsize=1100:vbv-maxrate=1100 -preset medium -profile:v high -level:v 4.0 -y -pix_fmt yuv420p -af "aformat=channel_layouts=stereo, compand=0 0:1 1:-90/-900 -70/-70 -30/-9 0/-3:6:0:0:0, volume=6dB" "dest.mp4"

    The throttled max 1100kbps is for 720p30 videos that do not need to be pixel peeped, so that bitrate works just fine.

    I define as stereo as suggested, run the recipe as issued and boost by 6db because the source audio is a tad low in the videos I am converting.


    Ive been using SOX in Avisynth, but sometimes... its just better to let FFMPEG do everything.
    Here is the SOX recipe I was using in Avisynth:
    soxfilter("compand 0.1,0.3 -90,-90,-70,-55,-50,-35,-31,-31,-21,-21,0,-20 0 0 0.1")

    I would have to decode the arguments to figure out how to translate to FFMPEG, when I copy and pasted the above before, it didnt work I suspect the "," were not doing any justice in the audio filter section with FFMPEG.

    Anyway, I hope this helps someone who is trying to do similar!

    Andrew
    Quote Quote  
  12. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Update:

    Currently using this with FFMPEG and movies are much better to watch now!

    Code:
    -filter:a "compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2"
    I borrowed the formula from:
    https://medium.com/@jud.dagnall/dynamic-range-compression-for-audio-with-ffmpeg-and-co...d-621fe2b1a892


    HTH,
    Andrew
    Quote Quote  
  13. Instead compand IMHO there is better filter to normalize loudness https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!