POV-Ray : Newsgroups : povray.off-topic : ffmpeg and normalizing audio volume : Re: ffmpeg and normalizing audio volume Server Time
2 Jul 2024 22:44:53 EDT (-0400)
  Re: ffmpeg and normalizing audio volume  
From: Doctor John
Date: 8 May 2016 08:44:02
Message: <572f3492$1@news.povray.org>
On 08/05/16 13:24, jr wrote:
> hi,
> 
> On 08/05/2016 11:59, Doctor John wrote:
>> Last half of console stream, the line you want is the penultimate one:
>> [Parsed_volumedetect_0 @ 0x1fb3580] n_samples: 21623936
>> [Parsed_volumedetect_0 @ 0x1fb3580] mean_volume: -13.1 dB
>> [Parsed_volumedetect_0 @ 0x1fb3580] max_volume: 0.0 dB
>> [Parsed_volumedetect_0 @ 0x1fb3580] histogram_0db: 30166
>>
> 
> off the top of my head, ie untested, write a script containing the
> following:
> 
> #!/bin/sh
> 
> DBV=$(ffmpeg -i "$1" -af "volumedetect" -f null /dev/null | \
>        grep max_volume | cut -d: -f2 | cut -d' ' -f2)
> #                                               ^^^
> # not sure what the /dev/null does without '>' or '&>' redirection.
> # typo?
> # DBV will now have 0.0.
> 
> ffmpeg -i "$1" -af "volume=${DBV}dB" "$1"
> 
> 
> 
> then make it executable, ie $ chmod u+x mycmd
> 
> if the ffmpeg commands work exactly the same for all three file types,
> run 'find' either three times with different extensions, or wrestle with
> 'find' and supply all three linked with '-or's.
> 
>>>   $ find ~/Music -type f -name \*.mp3 -exec ~/mycmd {} \;
> 
>> So, as I understand it and assuming I want to process all mp3s, oggs and
>> flacs together, I need to 'find' each music file then use 'grep' to
> 
> find does the finding and recursive tree walk (provided all directories
> below ~/Music reside on the same filesystem).
> 
>> Of course my real problem is that I usually bugger up any script
>> requiring the use of regexes.
> 
> you're not alone.  :-)
> 
> jr.
> 

I've just been informed by She_who_must_be_obeyed that if I don't lay
the table for Sunday lunch, the consequences will be terrible.

I'll do some testing later on this evening

John

-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.