Skip to main content

Normalize audio via ffmpeg / avconv

Project description

ffmpeg script for normalizing audio.

This program normalizes media files to a certain dB level. The default is an RMS-based normalization where the mean is lifted. Peak normalization is possible with the -m option.

It takes any audio or video file as input, and writes the audio part as output WAV file. The normalized audio can also be merged with the original.

Requirements:

  • Python 2.7 (Python 3 is not supported yet)

  • ffmpeg from http://ffmpeg.org/ installed in your $PATH

Installation:

pip install ffmpeg-normalize

Usage:

ffmpeg-normalize [options] <input-file>...

Options:

  • -f, --force — Force overwriting existing files

  • -l, --level <level> — dB level to normalize to [default: -26]

  • -p, --prefix <prefix> — Normalized file prefix [default: normalized]

  • -np, --no-prefix — Write output file without prefix

  • -t, --threshold <threshold> — dB threshold below which the audio will be not adjusted [default: 0.5]

  • -o, --dir — Create an output folder with the prefix instead of prefixing the file (does not work if “–no-prefix” is chosen)

  • -m, --max — Normalize to the maximum (peak) volume instead of RMS

  • -v, --verbose — Enable verbose output

  • -n, --dry-run — Show what would be done, do not convert

  • -d, --debug — Show debug output

  • -u, --merge — Don’t create a separate WAV file but update the original file. Use in combination with -p to create a copy

  • -a, --acodec <acodec> — Set audio codec for ffmpeg (see “ffmpeg -encoders”) when merging. If not set, default from ffmpeg will be used.

  • -e, --extra-options <extra-options> — Set extra options passed to ffmpeg (e.g. “-b:a 192k” to set audio bitrate)

Examples:

ffmpeg-normalize -v file.mp3
ffmpeg-normalize -v *.avi
ffmpeg-normalize -u -v -o -f -m -l -5 *.mp4
ffmpeg-normalize -u -v -a libfdk_aac -e "-b:a 192k" *.mkv

History

0.3 (2017-01-19)

  • Add option to remove prefix

0.2.4 (2016-10-27)

  • Fixed issue where multiple spaces were collapsed into one

0.2.3 (2016-02-12)

  • Fixed issue where ffmpeg could not be found if path included spaces

0.2.2 (2016-02-09)

  • Change default level back to -26

0.2.1 (2016-02-08)

  • Documentation fixes

0.2.0 (2016-02-08)

  • Support multiple input files

  • Allow merging with input file instead of creating separate WAV

  • Write to directory instead of using prefix

  • Set the audio codec when merging

  • Set additional encoder or ffmpeg options

Note: avconv support is very limited, use the real ffmpeg from http://ffmpeg.org/ instead.

0.1.3 (2015-12-15)

  • Bugfix for detecting ffmpeg or avconv on Windows (as .exe)

  • Add version to Usage message

  • Update year

0.1.2 (2015-11-13)

  • Bugfix for missing ffmpeg or avconv

0.1.0 (2015-08-01)

  • First release, changing name to ffmpeg-normalize

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffmpeg-normalize-0.2.5.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file ffmpeg-normalize-0.2.5.tar.gz.

File metadata

File hashes

Hashes for ffmpeg-normalize-0.2.5.tar.gz
Algorithm Hash digest
SHA256 a4578e220daa22252f8bc4dedc267dda4a9d70c4f5a976cfd14818a3b31833ca
MD5 a587cfd03b60fc5fdd4ec1b1de1dc300
BLAKE2b-256 160ab0ac1e2f4db5196d56cd4efe543fc8676a2423ef7097e1a7089746317c21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page