|
![](/i/fill.gif) |
On 08/05/16 11:00, jr wrote:
> hi,
>
> On 07/05/2016 13:14, Doctor John wrote:
>> The slow way of doing it is to detect the maximum volume of each file
>> with 'ffmpeg -i example.mp3 -af "volumedetect" -f null /dev/null', note
>
> using ffmpeg v 0.8.7 here, get message "Unrecognised option 'af'".
>
Time to update, methinks. I'm using version 3.0.1
>
> I'm not familiar with 'ffmpeg' (I use 'lame' for recoding mp3s) and
> don't know the exact format of the "volume" line you get from volumedetect.
>
Last half of console stream, the line you want is the penultimate one:
Output #0, null, to '/dev/null':
Metadata:
encoder : Lavf57.25.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
TITLE : Always The Sun
ARTIST : The Stranglers
ALBUM : Unknown Disc
encoder : Lavc57.24.102 pcm_s16le
Stream mapping:
Stream #0:0 -> #0:0 (vorbis (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=N/A time=00:04:05.16 bitrate=N/A speed= 371x
video:0kB audio:42234kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
[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
> however, I'd opt for a two-stage approach: (i) write a shell script
> which processes a single file named on its command-line, (ii) use the
> 'find' utility to process all (named) files, eg, if your shell script is
> ~/mycmd:
>
> $ find ~/Music -type f -name \*.mp3 -exec ~/mycmd {} \;
>
> the backslashes are necessary; find also supports a this-filename -or
> that-filename syntax but requires backslach escapes all over the place.
>
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
strip out the max_volume numbers, invert those and put the resulting
number into 'ffmpeg -i [filename] -af "volume=[whatever]dB" [filename]'.
Of course my real problem is that I usually bugger up any script
requiring the use of regexes.
Thanks for taking the time to think about the process
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
|
![](/i/fill.gif) |