POV-Ray : Newsgroups : povray.off-topic : ffmpeg and normalizing audio volume : Re: ffmpeg and normalizing audio volume Server Time
2 Jul 2024 23:26:01 EDT (-0400)
  Re: ffmpeg and normalizing audio volume  
From: jr
Date: 8 May 2016 08:24:31
Message: <572f2fff@news.povray.org>
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.


Post a reply to this message

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