Giter VIP home page Giter VIP logo

ffmpeg-normalize's Introduction

ffmpeg-normalize

All Contributors

PyPI version

Python package

A utility for batch-normalizing audio using ffmpeg.

This program normalizes media files to a certain loudness level using the EBU R128 loudness normalization procedure. It can also perform RMS-based normalization (where the mean is lifted or attenuated), or peak normalization to a certain target level.

Batch processing of several input files is possible, including video files.

A very quick how-to:

  1. Install a recent version of ffmpeg
  2. Run pip3 install ffmpeg-normalize
  3. Run ffmpeg-normalize /path/to/your/file.mp4
  4. Done! ๐ŸŽง (the file will be in a folder called normalized)

Read on for more info.

Contents:


Requirements

You need Python 3.8 or higher.

ffmpeg

  • ffmpeg 5.x is required, ffmpeg 6.x is recommended (it fixes a bug for short files)
  • Download a static build for your system
  • Place the ffmpeg executable in your $PATH, or specify the path to the binary with the FFMPEG_PATH environment variable in ffmpeg-normalize

For instance, under Linux:

wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
mkdir -p ffmpeg
tar -xf ffmpeg-release-amd64-static.tar.xz -C ffmpeg --strip-components=1
sudo cp ffmpeg/ffmpeg /usr/local/bin
sudo cp ffmpeg/ffprobe /usr/local/bin
sudo chmod +x /usr/local/bin/ffmpeg /usr/local/bin/ffprobe

For Windows, follow this guide.

For macOS and Linux, you can also use Homebrew:

brew install ffmpeg

Note that using distribution packages (e.g., apt install ffmpeg) is not recommended, as these are often outdated.

Installation

For Python 3 and pip:

pip3 install ffmpeg-normalize

Or download this repository, then run pip3 install ..

Docker Build

Download this repository and run

docker build -t ffmpeg-normalize .

Run using Windows Powershell or Linux:

docker run  -v "$(pwd):/tmp" -it ffmpeg-normalize /bin/sh

This will mount your current folder to the /tmp directory inside the container

Note: The container will run in interactive mode.

Example Usage:

PS C:\yonkers> docker run  -v "$(pwd):/tmp" -it ffmpeg-normalize /bin/sh
/ # cd /tmp
/tmp # ls
01. Goblin.mp3
/tmp # ffmpeg-normalize "01. Goblin.mp3" -f -c:a libmp3lame -b:a 320k --target-level -13 --output "01. Goblin normalized.mp3"
WARNING: The chosen output extension mp3 does not support video/cover art. It will be disabled.
/tmp # ls
01. Goblin normalized.mp3
01. Goblin.mp3

Usage

ffmpeg-normalize input [input ...][-h][-o OUTPUT [OUTPUT ...]] [options]

Example:

ffmpeg-normalize 1.wav 2.wav -o 1-normalized.m4a 2-normalized.m4a -c:a aac -b:a 192k

For more information on the options ([options]) available, run ffmpeg-normalize -h, or read on.

Description

Please read this section for a high level introduction.

What does the program do?

The program takes one or more input files and, by default, writes them to a folder called normalized, using an .mkv container. All audio streams will be normalized so that they have the same (perceived) volume.

How do I specify the input?

Just give the program one or more input files as arguments. It works with most media files.

How do I specify the output?

You can specify one output file name for each input file with the -o option. In this case, the container format (e.g. .wav) will be inferred from the file name extension that you've given.

Example:

ffmpeg-normalize 1.wav 2.wav -o 1n.wav 2n.wav

If you don't specify the output file name for an input file, the container format will be MKV, and the output will be written to normalized/<input>.mkv.

Using the -ext option, you can supply a different output extension common to all output files, e.g. -ext m4a.

What will get normalized?

By default, all streams from the input file will be written to the output file. For example, if your input is a video with two language tracks and a subtitle track, both audio tracks will be normalized independently. The video and subtitle tracks will be copied over to the output file.

How will the normalization be done?

The normalization will be performed with the loudnorm filter from FFmpeg, which was originally written by Kyle Swanson. It will bring the audio to a specified target level. This ensures that multiple files normalized with this filter will have the same perceived loudness.

What codec is chosen?

The default audio encoding method is uncompressed PCM (pcm_s16le) to avoid introducing compression artifacts. This will result in a much higher bitrate than you might want, for example if your input files are MP3s.

Some containers (like MP4) also cannot handle PCM audio. If you want to use such containers and/or keep the file size down, use -c:a and specify an audio codec (e.g., -c:a aac for ffmpeg's built-in AAC encoder).

Examples

Read the examples on the wiki.

Detailed Options

File Input/Output

  • input: Input media file(s)

  • -o OUTPUT [OUTPUT ...], --output OUTPUT [OUTPUT ...]: Output file names.

    Will be applied per input file.

    If no output file name is specified for an input file, the output files will be written to the default output folder with the name <input>.<ext>, where <ext> is the output extension (see -ext option).

    Example: ffmpeg-normalize 1.wav 2.wav -o 1n.wav 2n.wav

  • -of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER: Output folder (default: normalized)

    This folder will be used for input files that have no explicit output name specified.

General

  • -f, --force: Force overwrite existing files

  • -d, --debug: Print debugging output

  • -v, --verbose: Print verbose output

  • -q, --quiet: Only print errors

  • -n, --dry-run: Do not run normalization, only print what would be done

  • -pr, --progress: Show progress bar for files and streams

  • --version: Print version and exit

Normalization

  • -nt {ebu,rms,peak}, --normalization-type {ebu,rms,peak}: Normalization type (default: ebu).

    EBU normalization performs two passes and normalizes according to EBU R128.

    RMS-based normalization brings the input file to the specified RMS level.

    Peak normalization brings the signal to the specified peak level.

  • -t TARGET_LEVEL, --target-level TARGET_LEVEL: Normalization target level in dB/LUFS (default: -23).

    For EBU normalization, it corresponds to Integrated Loudness Target in LUFS. The range is -70.0 - -5.0.

    Otherwise, the range is -99 to 0.

  • -p, --print-stats: Print loudness statistics for both passes formatted as JSON to stdout.

EBU R128 Normalization

  • -lrt LOUDNESS_RANGE_TARGET, --loudness-range-target LOUDNESS_RANGE_TARGET: EBU Loudness Range Target in LUFS (default: 7.0).

    Range is 1.0 - 50.0.

  • --keep-loudness-range-target: Keep the input loudness range target to allow for linear normalization.

  • --keep-lra-above-loudness-range-target: Keep input loudness range above loudness range target.

    • LOUDNESS_RANGE_TARGET for input loudness range <= LOUDNESS_RANGE_TARGET or
    • keep input loudness range target above LOUDNESS_RANGE_TARGET.

    as alternative to --keep-loudness-range-target to allow for linear normalization.

  • -tp TRUE_PEAK, --true-peak TRUE_PEAK: EBU Maximum True Peak in dBTP (default: -2.0).

    Range is -9.0 - +0.0.

  • --offset OFFSET: EBU Offset Gain (default: 0.0).

    The gain is applied before the true-peak limiter in the first pass only. The offset for the second pass will be automatically determined based on the first pass statistics.

    Range is -99.0 - +99.0.

  • --dual-mono: Treat mono input files as "dual-mono".

    If a mono file is intended for playback on a stereo system, its EBU R128 measurement will be perceptually incorrect. If set, this option will compensate for this effect. Multi-channel input files are not affected by this option.

  • --dynamic: Force dynamic normalization mode.

    Instead of applying linear EBU R128 normalization, choose a dynamic normalization. This is not usually recommended.

    Dynamic mode will automatically change the sample rate to 192 kHz. Use -ar/--sample-rate to specify a different output sample rate.

Audio Encoding

  • -c:a AUDIO_CODEC, --audio-codec AUDIO_CODEC: Audio codec to use for output files.

    See ffmpeg -encoders for a list.

    Will use PCM audio with input stream bit depth by default.

  • -b:a AUDIO_BITRATE, --audio-bitrate AUDIO_BITRATE: Audio bitrate in bits/s, or with K suffix.

    If not specified, will use codec default.

  • -ar SAMPLE_RATE, --sample-rate SAMPLE_RATE: Audio sample rate to use for output files in Hz.

    Will use input sample rate by default, except for EBU normalization, which will change the input sample rate to 192 kHz.

  • -koa, --keep-original-audio: Copy original, non-normalized audio streams to output file

  • -prf PRE_FILTER, --pre-filter PRE_FILTER: Add an audio filter chain before applying normalization.

    Multiple filters can be specified by comma-separating them.

  • -pof POST_FILTER, --post-filter POST_FILTER: Add an audio filter chain after applying normalization.

    Multiple filters can be specified by comma-separating them.

    For EBU, the filter will be applied during the second pass.

Other Encoding Options

  • -vn, --video-disable: Do not write video streams to output

  • -c:v VIDEO_CODEC, --video-codec VIDEO_CODEC: Video codec to use for output files (default: 'copy').

    See ffmpeg -encoders for a list.

    Will attempt to copy video codec by default.

  • -sn, --subtitle-disable: Do not write subtitle streams to output

  • -mn, --metadata-disable: Do not write metadata to output

  • -cn, --chapters-disable: Do not write chapters to output

Input/Output Format

  • -ei EXTRA_INPUT_OPTIONS, --extra-input-options EXTRA_INPUT_OPTIONS: Extra input options list.

    A list of extra ffmpeg command line arguments valid for the input, applied before ffmpeg's -i.

    You can either use a JSON-formatted list (i.e., a list of comma-separated, quoted elements within square brackets), or a simple string of space-separated arguments.

    If JSON is used, you need to wrap the whole argument in quotes to prevent shell expansion and to preserve literal quotes inside the string. If a simple string is used, you need to specify the argument with -e=.

    Examples: -ei '[ "-f", "mpegts", "-r", "24" ]' or -ei="-f mpegts -r 24"

  • -e EXTRA_OUTPUT_OPTIONS, --extra-output-options EXTRA_OUTPUT_OPTIONS: Extra output options list.

    A list of extra ffmpeg command line arguments valid for the output.

    You can either use a JSON-formatted list (i.e., a list of comma-separated, quoted elements within square brackets), or a simple string of space-separated arguments.

    If JSON is used, you need to wrap the whole argument in quotes to prevent shell expansion and to preserve literal quotes inside the string. If a simple string is used, you need to specify the argument with -e=.

    Examples: -e '[ "-vbr", "3", "-preset:v", "ultrafast" ]' or -e="-vbr 3 -preset:v ultrafast"

  • -ofmt OUTPUT_FORMAT, --output-format OUTPUT_FORMAT: Media format to use for output file(s).

    See ffmpeg -formats for a list.

    If not specified, the format will be inferred by ffmpeg from the output file name. If the output file name is not explicitly specified, the extension will govern the format (see '--extension' option).

  • -ext EXTENSION, --extension EXTENSION: Output file extension to use for output files that were not explicitly specified. (Default: mkv)

Environment Variables

The program additionally respects environment variables:

  • TMP / TEMP / TMPDIR

    Sets the path to the temporary directory in which files are stored before being moved to the final output directory. Note: You need to use full paths.

  • FFMPEG_PATH

    Sets the full path to an ffmpeg executable other than the system default or you can provide a file name available on $PATH

API

This program has a simple API that can be used to integrate it into other Python programs.

For more information see the API documentation.

FAQ

The program doesn't work because the "loudnorm" filter can't be found

Make sure you run a recent ffmpeg version and that loudnorm is part of the output when you run ffmpeg -filters. Many distributions package outdated ffmpeg versions, or (even worse), Libav's ffmpeg disguising as a real ffmpeg from the FFmpeg project.

Some ffmpeg builds also do not have the loudnorm filter enabled.

You can always download a static build from their website and use that.

If you have to use an outdated ffmpeg version, you can only use rms or peak as normalization types, but I can't promise that the program will work correctly.

Should I use this to normalize my music collection?

When you run ffmpeg-normalize and re-encode files with MP3 or AAC, you will inevitably introduce generation loss. Therefore, I do not recommend running this on your precious music collection, unless you have a backup of the originals or accept potential quality reduction. If you just want to normalize the subjective volume of the files without changing the actual content, consider using MP3Gain and aacgain.

Why are my output files MKV?

I chose MKV as a default output container since it handles almost every possible combination of audio, video, and subtitle codecs. If you know which audio/video codec you want, and which container is supported, use the output options to specify the encoder and output file name manually.

"Could not write header for output file" error

See the next section.

The conversion does not work and I get a cryptic ffmpeg error!

Maybe ffmpeg says something like:

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Or the program says:

โ€ฆ Please choose a suitable audio codec with the -c:a option.

One possible reason is that the input file contains some streams that cannot be mapped to the output file, or that you are using a codec that does not work for the output file. Examples:

  • You are trying to normalize a movie file, writing to a .wav or .mp3 file. WAV/MP3 files only support audio, not video. Disable video and subtitles with -vn and -sn, or choose a container that supports video (e.g. .mkv).

  • You are trying to normalize a file, writing to an .mp4 container. This program defaults to PCM audio, but MP4 does not support PCM audio. Make sure that your audio codec is set to something MP4 containers support (e.g. -c:a aac).

The default output container is .mkv as it will support most input stream types. If you want a different output container, make sure that it supports your input file's video, audio, and subtitle streams (if any).

Also, if there is some other broken metadata, you can try to disable copying over of metadata with -mn.

Finally, make sure you use a recent version of ffmpeg. The static builds are usually the best option.

What are the different normalization algorithms?

  • EBU R128 is an EBU standard that is commonly used in the broadcasting world. The normalization is performed using a psychoacoustic model that targets a subjective loudness level measured in LUFS (Loudness Unit Full Scale). R128 is subjectively more accurate than any peak or RMS-based normalization. More info on R128 can be found in the official document and the loudnorm filter description by its original author.

  • Peak Normalization analyzes the peak signal level in dBFS and increases the volume of the input signal such that the maximum in the output is 0 dB (or any other chosen threshold). Since spikes in the signal can cause high volume peaks, peak normalization might still result in files that are subjectively quieter than other, non-peak-normalized files.

  • RMS-based Normalization analyzes the RMS power of the signal and changes the volume such that a new RMS target is reached. Otherwise it works similar to peak normalization.

Couldn't I just run loudnorm with ffmpeg?

You absolutely can. However, you can get better accuracy and linear normalization with two passes of the filter. Since ffmpeg does not allow you to automatically run these two passes, you have to do it yourself and parse the output values from the first run.

If ffmpeg-normalize is too over-engineered for you, you could also use an approach such as featured in this Ruby script that performs the two loudnorm passes.

If you want dynamic normalization (the loudnorm default), simply use ffmpeg with one pass, e.g.:

ffmpeg -i input.mp3 -af loudnorm -c:a aac -b:a 192k output.m4a

What about speech?

You should check out the speechnorm filter that is part of ffmpeg. It is a designed to be used in one pass, so you don't need this script at all.

See the documentation for more information.

After updating, this program does not work as expected anymore!

You are probably using a 0.x version of this program. There are significant changes to the command line arguments and inner workings of this program, so please adapt your scripts to the new one. Those changes were necessary to address a few issues that kept piling up; leaving the program as-is would have made it hard to extend it. You can continue using the old version (find it under Releases on GitHub or request the specific version from PyPi), but it will not be supported anymore.

Can I buy you a beer / coffee / random drink?

If you found this program useful and feel like giving back, feel free to send a donation via PayPal.

Related Tools and Articles

(Have a link? Please propose an edit to this section via a pull request!)

Contributors

Benjamin Balder Bach
Benjamin Balder Bach

๐Ÿ’ป
Eleni Lixourioti
Eleni Lixourioti

๐Ÿ’ป
thenewguy
thenewguy

๐Ÿ’ป
Anthony Violo
Anthony Violo

๐Ÿ’ป
Eric Jacobs
Eric Jacobs

๐Ÿ’ป
kostalski
kostalski

๐Ÿ’ป
Justin Pearson
Justin Pearson

๐Ÿ’ป
ad90xa0-aa
ad90xa0-aa

๐Ÿ’ป
Mathijs
Mathijs

๐Ÿ’ป
Marc Pรผls
Marc Pรผls

๐Ÿ’ป
Michael V. Battista
Michael V. Battista

๐Ÿ’ป
WyattBlue
WyattBlue

๐Ÿ’ป
Jan-Frederik Schmidt
Jan-Frederik Schmidt

๐Ÿ’ป
mjhalwa
mjhalwa

๐Ÿ’ป
07416
07416

๐Ÿ“–
sian1468
sian1468

โš ๏ธ
Panayiotis Savva
Panayiotis Savva

๐Ÿ’ป
HighMans
HighMans

๐Ÿ’ป
Add your contributions

License

The MIT License (MIT)

Copyright (c) 2015-2022 Werner Robitza

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ffmpeg-normalize's People

Contributors

allcontributors[bot] avatar aviolo avatar benjaoming avatar g3n35i5 avatar geekfish avatar jetpks avatar justinpearson avatar kostalski avatar mathijsz avatar mjhalwa avatar mpuels avatar mvbattista avatar nottt avatar psavva avatar retokromer avatar sian1468 avatar slhck avatar thenewguy avatar wyattblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffmpeg-normalize's Issues

Re-add threshold to skip normalization if not needed

Add a threshold parameter again and copy audio stream (and video/subtitle stream) in case normalization would not be necessary.

For loudnorm, this still requires at least the first pass. For peak and RMS, this only requires the volumedetect filter.

avconv options not implemented

After I added avconv/normalize-audio, I left behind a couple of options:

-l, --level
-m --max

Probably, there is a way to re-implement them!

Don't know what is going on here.

capture
I just downloaded and installed Python 3.5.1 from the site and got that installed. I got your script using the pip you had listed on the site. That all worked.
Then I tried a test dry run on a wav file I have it less then 30 seconds all told. Here is what I got when I run your script.

C:\Users\micha\Documents\Script sounds>ffmpeg-normalize -n -d -v done.wav 2016-01-29 15:13:03,564 - ffmpeg_normalize - DEBUG - {'--debug': True, '--dry-run': True, '--force': False, '--level': '-26', '--max': False, '--prefix': 'normalized', '--verbose': True, '-m/--max': None, '<input-file>': ['done.wav']} 2016-01-29 15:13:03,565 - ffmpeg_normalize - INFO - reading file done.wav 2016-01-29 15:13:03,565 - ffmpeg_normalize - DEBUG - [command] c:\ffmpeg\bin\ffmpeg -i "done.wav" -filter:a "volumedetect" -vn -sn -f null /dev/null 2016-01-29 15:13:03,655 - ffmpeg_normalize - DEBUG - b"ffmpeg version N-74566-g531b0a3 Copyright (c) 2000-2015 the FFmpeg developers\r\n built with gcc 4.9.3 (GCC)\r\n conf iguration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enabl e-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-l ibspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enab le-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib\r\n libavutil 54. 31.100 / 54. 31.100\r\n libavcodec 56. 58.100 / 56. 58.100\r\n libavformat 56. 40.101 / 56. 40.101\r\n libavdevice 56. 4.100 / 56. 4.100\r\n libavfilter 5. 36.100 / 5. 36.100\r\n libswscale 3. 1.101 / 3. 1.101\r\n libswresample 1. 2.101 / 1. 2.101\r\n libpostproc 53. 3.100 / 53. 3.100\r\nGuessed Channel Layout for Input Stream # 0.0 : stereo\r\nInput #0, wav, from 'done.wav':\r\n Metadata:\r\n encoder : Lavf56.40.101\r\n Duration: 00:00:08.24, bitrate: 705 kb/s\r\n Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 2 channels, s16, 705 kb/s\r\nOutput #0, null, to '/dev/null':\r\n Metadata:\r\n encoder : Lavf56.40.101\r\n Strea m #0:0: Audio: pcm_s16le, 22050 Hz, stereo, s16, 705 kb/s\r\n Metadata:\r\n encoder : Lavc56.58.100 pcm_s16le\r\nStream mapping:\r\n Stream #0:0 -> #0:0 (pcm _s16le (native) -> pcm_s16le (native))\r\nPress [q] to stop, [?] for help\r\nsize=N/A time=00:00:08.23 bitrate=N/A \r\nvideo:0kB audio:710kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown\r\n[Parsed_volumedetect_0 @ 00000000052411c0] n_samples: 363268\r\n[Parsed_volumedetect_0 @ 00000000052411c0] mean_volume: -20.3 dB\r\n[Parsed_volumedetect_0 @ 00000000052411c0] max_volume: -4.9 dB\r\n[Parsed_volumedetect_0 @ 00000000052411c0] histogram_4db: 2\r\n[Parsed_volumedetect_0 @ 00000000052411 c0] histogram_5db: 30\r\n[Parsed_volumedetect_0 @ 00000000052411c0] histogram_6db: 212\r\n[Parsed_volumedetect_0 @ 00000000052411c0] histogram_7db: 472\r\n" Traceback (most recent call last): File "C:\Python35-32\Scripts\ffmpeg-normalize-script.py", line 9, in <module> load_entry_point('ffmpeg-normalize==0.1.3', 'console_scripts', 'ffmpeg-normalize')() File "c:\python35-32\lib\site-packages\ffmpeg_normalize\__main__.py", line 197, in main mean, maximum = ffmpeg_get_mean(input_file) File "c:\python35-32\lib\site-packages\ffmpeg_normalize\__main__.py", line 143, in ffmpeg_get_mean mean_volume_matches = re.findall(r"mean_volume: ([\-\d\.]+) dB", output) File "c:\python35-32\lib\re.py", line 213, in findall return _compile(pattern, flags).findall(string) TypeError: cannot use a string pattern on a bytes-like object

Now I'm new to python but not new to programming, but this debug dump did not help me to try to find what was causing this. Before you ask I'm run windows 10 build 11099.rs1_release.160109-1156 it is a 64 bit build and I have 8GB of RAM. So I hope this helps you in trying to fix the script. I would love to use it as it's something I have need very badly for some time now.
I have added a screen grab of my terminal out put.

Mutliple files on windows (powershell or command line)

Hey,

Your script is working for single file perfectly, but when using ffmpeg-normalize -vuo *.mp4 i get an error 2017-05-12 11:22:09,763 - ffmpeg_normalize - ERROR - file *.mp4 does not exist, will skip.

It's working fine on WSL

normalize and overwrite same file

I tried ffmpeg-normalize --no-prefix -rMP3 --level=-12 --force *.MP3

to normalize a bunch of files, and just overwrite them after normalizing is done. ffmpeg-normalize says output file is the same as input file, cannot proceed. I guess this cannot work because of the design of ffmpeg itself?

how to batch .avi files

Hi thanks for the software

i use the command to do 1 by 1 but i have all the videos files ina folder over 682 videos and i want to do batch on windows i tried all the command and it doesnt work

can you help me please

ffmpeg-normalize --dir --force --acodec libmp3lame --extra-options "-b:a 320k" -l -10 *.avi
๏ฟฝ[1;31mERROR๏ฟฝ[1;0m: file *.avi does not exist, will skip

for %%A IN (*.avi) DO ffmpeg-normalize "%%A" --merge --force --acodec libmp3lame --extra-options "-b:a 320k" -l -10

C:\Users***\Documents\Mix 682 Songs>for %%A IN (.avi) DO ffmpeg-normalize --merge --dir --acodec libmp3lame --extra-options "-b:a 320k" -l -10 "%%A"
%%A was unexpected at this time.

C:\Users***\Documents\Mix 682 Songs>for %%A IN (.avi) DO ffmpeg-normalize "%%A" --merge --dir --acodec libmp3lame --extra-options "-b:a 320k" -l -10
%%A was unexpected at this time.

tired all the things and couldnt get it to work please let me know

Temporary directory option

Would it be possible to have a setting for the temporary file(s) location? The reason I ask is because I use this script on a machine with very little local disk space and I access the files over NFS. I haven't run into an issue yet but I'm only testing with smaller files at the moment.

Thanks for the awesome script, I've been looking for something like this for a while now.
Sorry for opening multiple issues in the last day or so!

A few things

  1. Please convert all line endings to UNIX format (they are currently in DOS format), otherwise the shebang doesn't work.

  2. Line 135: target_level = args.level should be target_level = float(args.level). Otherwise, Python 2.7 complains that it cannot subtract a float from a string on the next line.

  3. Please add an option (e.g. --max) to normalize maximum volume instead of mean volume, which would effectively change line 136 from target_level - mean to target_level - maximum. (This is how Audacity normalizes.)

  4. Warning on line 74 in ffmpeg_adjust_volume should call print, not print_verbose; I shouldn't have to use -v to see this warning.

run_command with default raw=True, why?

Hey,

It's bad practice to use popen with a string instead of a list of arguments, as argument escaping isn't done in that case.

Why is raw=True by default on run_command? This creates all sorts of issues.

You should simply provide a list of arguments, the executable being the first item in that list, to the popen call. That takes care of proper escaping.

That way, this would work:
ffmpeg-normalize --verbose --merge --force --acodec libfdk_aac --ebu --extra-options "-threads 4 -b:a 224k -filter:a compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0"

Instead now I have to single quote the compand filter to not get a wrong call to ffmpeg.

If you do not want that (due to popen replacing os.system perhaps?), you can use this to sanitize the argument list to a string:

import sys
mswindows = (sys.platform == "win32")

if mswindows:
    from subprocess import list2cmdline
    quote_args = list2cmdline
else:
    # POSIX
    from pipes import quote

    def quote_args(seq):
        return ' '.join(quote(arg) for arg in seq)

Better input/output file handling

The current input/output file handling options are just based on a legacy script.

It'd be better if users supplied their output file name, therefore:

ffmpeg-normalize INPUT [INPUT ...] -o OUTPUT [OUTPUT ...]

This would override the prefix if -o is specified; users can simply use a shell loop:

for f in *.wav; do ffmpeg-normalize "$f" -o "dir/foo-$f"; done

Allow force-overwrite when normalizing

I was doing a bulk conversion of audio files when I noticed some files hadn't been converted. I ran the tool with verbose output and noticed this output:

2017-04-17 01:58:59,787 - ffmpeg_normalize - INFO - file needs -0.1 dB gain to reach -26 dB
2017-04-17 01:58:59,787 - ffmpeg_normalize - INFO - gain = -0.1, will not adjust file

I appreciate that no unnecessary work will be done here, but for bulk scripting it's sometimes useful to make a copy even if no processing needed to happen. Anyway, not a big deal, but could be a nice feature. Thanks!

appropriate settings and difference from ffmpeg

Hi, I am not reporting a bug; I just have a usage question about this script. First of all, I am confused about what the value-add is over ffmpeg. But maybe there is one because I have tried to use ffmpeg for volume normalization and the results were not very satisfactory.

My application is that I want to use librivox audiobooks as training data for a machine learning model. These audiobooks are recorded under varying conditions with varying quality.

I tried using ffmpeg with the following option: af 'dynaudnorm=c=1:r=1:p=1'. I found that this seemed to do a bad job in the following sense. After running this, the difference between the max sample and min sample in my audio files is still all over the map (ranging from about .5 to almost 2). Do you know why this happens? Anyway, I found that to my model performs far better if, after running the ffmpeg command, I rescale the audio so that the difference between the max and min samples is the same in each 30 second segment. But this seems like an unprincipled hack, and it introduces DC bias. Would your script, with some particular options, be a better solution?

Also, if you happen to know of similar scripts to remove background noise or other artifacts of amateur recordings, I would be glad to know about them.

ver 0.7 has a bug with the -b flag

I run this command ffmpeg-normalize -u -v -b -a aac -e "-b:a 96k" "D:\seens\Meet The Press - 2017-08-06.mp4" and with just -l -27 not -b. I get a file that has aac encoded audio at a bitrate of 96K but when I run the above code I got a video file with aac audio but the it is not the Sampling rate of : 48.0 kHz it changes the Sampling rate not the bitrate.

Meet The Press - 2017-08-06.mp4.txt
This is the base file info before anything is done to it.
normalized by leveling-Meet The Press - 2017-08-06.mp4.txt
This one is done just useing the same code as above just with -l not -b
normalized-Meet The Press - 2017-08-06.mp4.txt
This is the output of the above code.
As you can see the one done with just the -l flag work just fine it's playable on almost anything. But the one done with -b flag masses around with the Sampling rate and that file can only be played from a computer using VLC or something like it. It will not even play any audio on my Samsung Note 3 run android 7.1.1 using VLC or MXPlayer with the FFMpeg codec bundle installed. But the fist two play just fine on my Note my 2 PS3's and all of the computers.
The ebu leveling shouldn't be messing around with the sampling rate at all.
Please have a look into this. If it's me please let me know how I can fix it as i use 96K bitrate audio to help save space on my NAS.
Thanks your friend in coding,
Michael

Can't Normalize 24 bit depth

Hello,

Seems like I can't normalize 24 bit depth files. Utility still converting them to 16 bit files
Can you have a look, pls?

clear && ffmpeg-normalize -d -f -v -a pcm_s24le 101-MA_5.1.flac
2016-08-25 18:36:24,551 - ffmpeg_normalize - DEBUG - {'--acodec': 'pcm_s24le',
 '--debug': True,
 '--dir': False,
 '--dry-run': False,
 '--extra-options': None,
 '--force': True,
 '--level': '-26',
 '--max': False,
 '--merge': False,
 '--prefix': 'normalized',
 '--threshold': '0.5',
 '--verbose': True,
 '<input-file>': ['101-MA_5.1.flac']}
2016-08-25 18:36:24,551 - ffmpeg_normalize - DEBUG - writing result in normalized-101-MA_5.1.wav
2016-08-25 18:36:24,551 - ffmpeg_normalize - INFO - reading file 1 of 1 - 101-MA_5.1.flac
2016-08-25 18:36:24,551 - ffmpeg_normalize - DEBUG - [command] "/usr/local/bin/ffmpeg" -i "101-MA_5.1.flac" -filter:a "volumedetect" -vn -sn -f null /dev/null
2016-08-25 18:36:24,674 - ffmpeg_normalize - DEBUG - ffmpeg version 3.1.2-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, flac, from '101-MA_5.1.flac':
  Metadata:
    ENCODER         : Lavf57.41.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 3263 kb/s
    Stream #0:0: Audio: flac, 48000 Hz, 5.1, s32 (24 bit)
[null @ 0x7f960b000000] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 5.1, s16 (24 bit), 4608 kb/s
    Metadata:
      encoder         : Lavc57.48.101 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=N/A time=00:00:10.00 bitrate=N/A speed= 454x
video:0kB audio:5625kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_volumedetect_0 @ 0x7f9608401e60] n_samples: 2880000
[Parsed_volumedetect_0 @ 0x7f9608401e60] mean_volume: -37.7 dB
[Parsed_volumedetect_0 @ 0x7f9608401e60] max_volume: -16.2 dB
[Parsed_volumedetect_0 @ 0x7f9608401e60] histogram_16db: 36
[Parsed_volumedetect_0 @ 0x7f9608401e60] histogram_17db: 158
[Parsed_volumedetect_0 @ 0x7f9608401e60] histogram_18db: 473
[Parsed_volumedetect_0 @ 0x7f9608401e60] histogram_19db: 901
[Parsed_volumedetect_0 @ 0x7f9608401e60] histogram_20db: 1640

2016-08-25 18:36:24,675 - ffmpeg_normalize - INFO - mean volume: -37.7
2016-08-25 18:36:24,675 - ffmpeg_normalize - INFO - max volume: -16.2
2016-08-25 18:36:24,675 - ffmpeg_normalize - INFO - file needs 11.7 dB gain to reach -26 dB
2016-08-25 18:36:24,675 - ffmpeg_normalize - DEBUG - [command] /usr/local/bin/ffmpeg -y -i "101-MA_5.1.flac" -vn -sn -filter:a "volume=11.7dB" -c:a pcm_s16le "normalized-101-MA_5.1.wav"
2016-08-25 18:36:24,735 - ffmpeg_normalize - INFO - normalized file written to normalized-101-MA_5.1.wav

No issues with running DEBUG command with 24 bit set directly:

 /usr/local/bin/ffmpeg -y -i "101-MA_5.1.flac" -vn -sn -filter:a "volume=11.7dB" -c:a pcm_s24le "normalized-101-MA_5.1.wav"
ffmpeg version 3.1.2-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, flac, from '101-MA_5.1.flac':
  Metadata:
    ENCODER         : Lavf57.41.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 3263 kb/s
    Stream #0:0: Audio: flac, 48000 Hz, 5.1, s32 (24 bit)
[wav @ 0x7fdeed814000] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, wav, to 'normalized-101-MA_5.1.wav':
  Metadata:
    ISFT            : Lavf57.41.100
    Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32 (24 bit), 6912 kb/s
    Metadata:
      encoder         : Lavc57.48.101 pcm_s24le
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
size=    8438kB time=00:00:10.00 bitrate=6912.1kbits/s speed=69.8x
video:0kB audio:8438kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001181%

ffmpeg-normalization of .mp4 fails on minimum need

I am trying to normalize a directory of .mp4 files to 0 db so I dont have to have my receiver cranked up. When it reaches a file that its says is below minimum to normalize it stops. I really want it to go through the entire directory and normalize everything needed. I am using Ubuntu 16.04 on an Odroid to perform this.

Is this normal behavior or something wrong?

Normlization of multi-audio-tracks files

Hi,

Currently, when ffmpeg-normalize processes a video file with several audio tracks (for example with different language), the code does consider only one track so that the output misses the other audio tracks.

Would it be possible for ffmpeg-normalize to apply the desired normalization to all the audio tracks within a video file?

Thanks

Spaces problem

Running on linux, if I pass a filename in with multiple consecutive spaces, ffmpeg gets a filename with the block if spaces converted to a single space and it then cannot find the file.
e.g. 'test name' gets passed to ffmpeg as 'test file'

Movie loudness compression

I've used this for an old series which has really bad sound mixing (starts with Doctor) on the remastered BluRay/DVD releases:

ffmpeg-normalize --verbose --merge --force --acodec libfdk_aac --ebu --extra-options "-threads 4 -b:a 224k -filter:a 'compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0'" *.mkv

Perhaps this helps someone who doesn't only want to normalize, but to even out peaks and lows, also.

Updated normalize ouputs video without sound

So I had a problem in the beginning with not processing certain videos. It appears you fixed that however, now it produces videos without ANY sound. I am using the below command. So either something is wrong with the command or with the program. Please advise.

ffmpeg-normalize -v -f -nt peak -t 0 -c:a aac -ext mp4 *.mp4

Proper Python module packaging

I'd love if it was possible to provide an easier import functionality for the program, where you could just simply do:

from ffmpeg_normalize import FFmpegNormalize, InputFile

... and then:

ff = FFmpegNormalize()
input_file = InputFile(...)
ff.add_input_file(input_file)
ff.run()

or something.

Cannot pip install in Python 3.6.1

I am trying to pip install ffmpeg-normalize in Python 3.6.1. This used to work fine in Python 2.7.13 but not in the latest version, it seems.

In an elevated command prompt i type: pip install ffmpeg-normalize

I continue to get Command "python setup.py egg_info" failed with error code 1 for some reason and I am not sure what this means...

    C:\Users\Arete>python --version
    Python 3.6.1
    
    C:\Users\Arete>pip install ffmpeg-normalize
    Collecting ffmpeg-normalize
      Using cached ffmpeg-normalize-0.4.3.tar.gz
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "C:\Users\Arete\AppData\Local\Temp\pip-build-rcxpzvv4\ffmpeg-normalize\setup.py", line 7, in <module>
            readme = readme_file.read()
          File "c:\program files\python36\lib\encodings\cp1252.py", line 23, in decode
            return codecs.charmap_decode(input,self.errors,decoding_table)[0]
        UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2117: character maps to <undefined>
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\Arete\AppData\Local\Temp\pip-build-rcxpzvv4\ffmpeg-normalize\
    
    C:\Users\Arete>

I am using Windows 10. and I have already tried the accepted answer on a very similar question without any luck...

What is causing the problem here and how can I get ffmpeg-normalize installed?

Windows file in use error

Just testing on a sample mkv file...

ffmpeg-normalize test.mkv -c:a aac -b:a 192k -f

...getting...
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\username\\AppData\\Local\\Temp\\tmpxcqezk6w.mkv' -> 'output.mkv'

Multiply file size up to 10 times

Hello
I am trying to normalize mp3 files (Stereo, 32 bits, 44 MHz).
When I do so with ffmpeg-normalize, the new normalized files are up to 10 times bigger in term of size.
Is there a way to avoid this?
Thank you
Fabrice

How to update to the latest branch?

I am sorry I am new to all this.

I have successfully installed the script using the following command:

pip install ffmpeg-normalize

I was just wondering how to update the same script.

Like we can do with apt-get update

have tried pip update, but there is no such command.

Thanks for the great script!

Ver 0.60 don't work on windows.

As my post says the new ver does not work right on windows any more.
As far as I can see it's because everything now has '' around it now and windows don't understand those both in PS or CL. Windows has to have "" around anything that gets passed to it. Oh just let you know my ffmpeg was just built from git just last night so it's not ffmpeg here it the syntax that is being used.
Thought I would let you know. You might want to think about forking a new build for windows as a lot of the stuff your trying to do may work in a *inux systems but don't work right under windows.

Can't seem to get it to work

Hi, I have setup a bat with this command:

ffmpeg-normalize "f:\_convert\input.mkv" -o "f:\_convert\normalized.mkv" -c:a aac -b:a 192k -v -d

I can't understand if it's working or not. No errors are thrown, but "normalized.mkv" is never created. The Task Manager says it's using some CPU, so maybe it's doing something.

Is there any way to get some sort of percentage of the running task?

Can't find ffmpeg on Windows

Have ffmpeg in my system path in windows 8.1. Windows command line sees it fine.

Using version 1.05 of your script finds ffmpeg and works fine. Version 1.06/1.07 both complain during install that it can't find it. Version 1.08 installs, but it says that the ffmpeg executable is not a valid file, the path that it lists is the correct path.

I downgraded back to 1.05, which is still working.

Default prefix "normalized" not working

Issue

The operation errors out if no prefix is given

Expected output

When no prefix is given, the default "normalized" should be assumed

Steps to reproduce

  1. ffmpeg-normalize.exe --merge --prefix --verbose VID_20170119_110840.mp4

Console output

ffmpeg-normalize.exe --merge --prefix --verbose VID_20170119_110840.mp4
2017-01-19 14:08:30,884 - ffmpeg_normalize - ERROR - error running command: "C:\Users\Dheeraj\include_in_path\ffmpeg" -y -i "VID_20170119_110840.mp4" -strict -2 -vcodec copy -af "volume=11.4dB" "--verbose-VID_20170119_110840.mp4"
2017-01-19 14:08:30,884 - ffmpeg_normalize - ERROR - ffmpeg version N-83152-gf7e9275 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 74.100 / 57. 74.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Unrecognized option '-verbose-VID_20170119_110840.mp4'.
Error splitting the argument list: Option not found

Cant do -ux or -uxf?

I would like to normalize audio contained in video files and I want the process to merge the audio back into the video container and then remove the old (not normalized) file.

This is all I get when I run it

shot_170731_010756

Where is the level set?

I'm new to the whole Python programming game, but where in the code is the -28 or 26 dB hard coded into the code? I can't find it and been over all of the files on here. I would like to know where that is set because I would like to mod it so i can have it ask for a level and remember that and not have to use a over ride eatch I make a call to the program in my batch files.

Invalid cross-device link

I'm running this command on my xubuntu box. The /tmp and /media/pool (where my target files are) are on separate file systems.

$ ffmpeg-normalize -vuxf "20170927--Why_Farming_Is_Broken_And_Always_Has_Been--UkMZJrbCRdQ.mp4"
INFO: reading file 1 of 1 - 20170927--Why_Farming_Is_Broken_And_Always_Has_Been--UkMZJrbCRdQ.mp4
INFO: mean volume: -18.8
INFO: max volume: 0.0
INFO: file needs -7.199999999999999 dB gain to reach -26.0 dB
WARNING: Merging audio with the original file, but encoder was automatically chosen. Set '--acodec' to overwrite.
Traceback (most recent call last):
  File "/usr/local/bin/ffmpeg-normalize", line 11, in <module>
    load_entry_point('ffmpeg-normalize==0.7.2', 'console_scripts', 'ffmpeg-normalize')()
  File "/usr/local/lib/python3.5/dist-packages/ffmpeg_normalize/__main__.py", line 479, in main
    ffmpeg_normalize.run()
  File "/usr/local/lib/python3.5/dist-packages/ffmpeg_normalize/__main__.py", line 448, in run
    input_file.move_tmp_file()
  File "/usr/local/lib/python3.5/dist-packages/ffmpeg_normalize/__main__.py", line 364, in move_tmp_file
    os.rename(self.output_file, self.input_file)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpf2hta6d7.mp4' -> '20170927--Why_Farming_Is_Broken_And_Always_Has_Been--UkMZJrbCRdQ.mp4'

From what I gather, the os.rename method can't be used across different file systems.

How a bug with the newest code.

Don't know what is going on but this is what I keep getting when I run the script with the "-v" flage.
Traceback (most recent call last):
File "C:\Python27\Scripts\ffmpeg-normalize-script.py", line 9, in
load_entry_point('ffmpeg-normalize==0.2.2', 'console_scripts', 'ffmpeg-normalize')()
File "c:\python27\lib\site-packages\ffmpeg_normalize__main__.py", line 247, in main
target_level = float(args['--level'])
ValueError: could not convert string to float: -v

Using ffmpeg_path

Could someone provide an example setting the ffmpeg_path variable?

Command "python setup.py egg_info" failed with error code 1

When trying sudo pip install ffmpeg-normalize on OS X with Python 2.7, I get this error message:

Collecting ffmpeg-normalize
  Downloading ffmpeg-normalize-0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/tmp/pip-build-ab9SEV/ffmpeg-normalize/setup.py", line 9, in <module>
        with open('HISTORY.rst') as history_file:
    IOError: [Errno 2] No such file or directory: 'HISTORY.rst'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-ab9SEV/ffmpeg-normalize

I haven't had this problem before when installing libraries so I'm not sure what to make of it.

Startup error

$ ffmpeg-normalize -h
Traceback (most recent call last):
File "c:\python33\lib\runpy.py", line 160, in run_module_as_main
"main", fname, loader, pkg_name)
File "c:\python33\lib\runpy.py", line 73, in run_code
exec(code, run_globals)
File "c:\Python33\Scripts\ffmpeg-normalize.exe__main
.py", line 5, in
File "c:\python33\lib\site-packages\ffmpeg_normalize__main__.py", line 96, in
if 'avconv' in FFMPEG_CMD:
TypeError: argument of type 'NoneType' is not iterable

Normalization With --no-prefix Flag Automatically Writes to /tmp

When running your utility with --no-prefix, the scripts generates the normalized file in /tmp and then overrides the old file with the new file. This works well for most of my needs. However, some video files on my system are ~8 GB. My free space on my / partition is around 6 GB. This means I am unable to use the --no-prefix flag on any files which are larger than around 6 GB. Is there any way to get around this limitation using ffmpeg-normalize itself?

I ended up writing a script to rename the normalized files, but it would have been nice not to need to. :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.