slhck / ffmpeg-normalize

Audio Normalization for Python/ffmpeg
MIT License
1.26k stars 117 forks source link

Can this be used to RMS normalize across multiple files? #43

Closed markreg closed 6 years ago

markreg commented 6 years ago

I have a folder of music from different albums all at varying volumes. Is it possible to use ffmpeg-normalize to analyze the RMS volume in all files and increase/alter the volume accordingly?

Thanks!

slhck commented 6 years ago

Yes, that is basically default behavior:

ffmpeg-normalize --verbose --dir --level -23 --acodec aac --extra-options "-b:a 192k" *.m4a

This will write AAC-encoded files to a folder called normalized. You may want to adjust the level depending on your preferences.

If you have music as MP3s, you may want to use MP3Gain instead. It does not re-encode the files and instead sets the normalization factor in the files' metadata.

markreg commented 6 years ago

Ok, I'll try that and report back.

Since I'm outputting the music from a raspberry pi over HDMI to a home theater a/v receiver (which I presume has some kind of amplifier) what is the appropriate volume to normalize the files to relative to the volume of the receiver?

For example, if -45dB on my receiver is approximately the volume at which I can reasonably hear the non-normalized music collection, what level would work best with ffmpeg-normalize? Thanks.

michaelcrossland commented 6 years ago

Try using -15 db then if that's to high try stepping it down by -5 db. As music will lower to low to fast. -26 and below it to much in most cases. I found that out with my ps3.

On Nov 23, 2017 11:25 AM, "markreg" notifications@github.com wrote:

Ok, I'll try that and report back.

Since I'm outputting the music from a raspberry pi over HDMI to a home theater a/v receiver (which I presume has some kind of amplifier) what is the appropriate volume to normalize the files to relative to the volume of the receiver?

For example, if -45dB on my receiver is approximately the volume at which I can reasonably hear the non-normalized music collection, what level would work best with ffmpeg-normalize? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/slhck/ffmpeg-normalize/issues/43#issuecomment-346670816, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhMBKRnpnZ6fSTcUU1QPTQu8PKwB7JXks5s5ap0gaJpZM4QoS_p .

markreg commented 6 years ago

I'm having trouble with an error:

ERROR: file *.mp3 does not exist, will skip

But it works when specifying one file after another on the same command.

michaelcrossland commented 6 years ago

it's because n windws yu can't use *.mp3 to run on more then one file. you have use that in a bat file.

When you're short of everything but the enemy, you're in combat. Don't run, you'll only die tired. - Army Snipers

On Fri, Nov 24, 2017 at 2:44 PM, markreg notifications@github.com wrote:

I'm having trouble with an error:

�[1;31mERROR�[1;0m: file *.mp3 does not exist, will skip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/slhck/ffmpeg-normalize/issues/43#issuecomment-346894005, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhMBPVK4VeahIqDSBZPQeLtlGj53i37ks5s5yqXgaJpZM4QoS_p .

slhck commented 6 years ago

Something like:

for %%A IN (*.mp3) DO ffmpeg-normalize … "%%A"
michaelcrossland commented 6 years ago

yes that wuld qrk if you want wav files not mp3's. you would have to add ffmpeg-normalize -u -v -a mp3 -e "-b:a 128k -ar 44100"

When you're short of everything but the enemy, you're in combat. Don't run, you'll only die tired. - Army Snipers

On Sat, Nov 25, 2017 at 4:09 AM, Werner Robitza notifications@github.com wrote:

Something like:

for %%A IN (*.mp3) DO ffmpeg-normalize … "%%A"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/slhck/ffmpeg-normalize/issues/43#issuecomment-346931273, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhMBNYCztrMFLKyWsgHsk4grZbOmraFks5s5-dygaJpZM4QoS_p .

markreg commented 6 years ago

Ok, the for loop worked well.

One last question, is there a way for ffmpeg-normalize to simply copy the file if no normalization needs to occur (rather than skipping the file)? Otherwise I need to copy the files which were not normalized from the original directory which may be forgotten. Thanks.

michaelcrossland commented 6 years ago

If you are using it windows short answer is no. Because there is no ez way to get the text output from the command prompt or Powershell you would need to do that under a unix like os.

On Dec 10, 2017 6:34 PM, "markreg" notifications@github.com wrote:

Ok, the for loop worked well.

One last question, is there a way for ffmpeg-normalize to simply copy the file if no normalization needs to occur (rather than skipping the file)? Otherwise I need to copy the files which were not normalized from the original directory which may be forgotten. Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/slhck/ffmpeg-normalize/issues/43#issuecomment-350595852, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhMBKhPDf-87kGOaTJZN-joX6aZlzaYks5s_HitgaJpZM4QoS_p .

slhck commented 6 years ago

is there a way for ffmpeg-normalize to simply copy the file if no normalization needs to occur

No, but this would be a nice feature addition. I'll put it on the list.