slhck/ffmpeg-normalize

Can't find ffmpeg.exe with ffmpeg_path set

JonRFleming opened this issue · 3 comments

I'm trying to normalize the audio of some mp4 files in Windows 11. Here's what happens:

[C:\Temporary]Normalize.cmd
"C:\Users{me}\AppData\Local\Programs\Python\Python312\Scripts\ffmpeg-normalize.exe" "C:\Temporary\Test.mp4" -o "C:\Temporary\Normalized" -c:a aac -b:a 128k -ofmt mp4 -ext mp4
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users{me}\AppData\Local\Programs\Python\Python312\Scripts\ffmpeg-normalize.exe_main
.py", line 7, in
File "C:\Users{me}\AppData\Local\Programs\Python\Python312\Lib\site-packages\ffmpeg_normalize_main
.py", line 494, in main
ffmpeg_normalize = FFmpegNormalize(
^^^^^^^^^^^^^^^^
File "C:\Users{me}\AppData\Local\Programs\Python\Python312\Lib\site-packages\ffmpeg_normalize_ffmpeg_normalize.py", line 116, in init
self.ffmpeg_exe = get_ffmpeg_exe()
^^^^^^^^^^^^^^^^
File "C:\Users{me}\AppData\Local\Programs\Python\Python312\Lib\site-packages\ffmpeg_normalize_cmd_utils.py", line 160, in get_ffmpeg_exe
raise FFmpegNormalizeError(f"No file exists at {ff_path}")
ffmpeg_normalize._errors.FFmpegNormalizeError: No file exists at C:\Program Files\FFMpeg

[C:\Temporary]set ffmpeg_path
C:\Program Files\FFMpeg

[C:\Temporary]dir "c:\Program Files\FFMpeg"

Volume in drive C is System Serial number is 5c30:a014
Directory of C:\Program Files\FFMpeg*

6/03/2024 11:14

.
5/27/2024 19:09 ..
6/03/2024 9:21 122,887,168 ffmpeg.exe
6/03/2024 9:21 122,703,872 ffplay.exe
6/03/2024 9:21 122,722,816 ffprobe.exe
368,313,856 bytes in 3 files and 2 dirs 368,316,416 bytes allocated
215,681,077,248 bytes free

[C:\Temporary]ffmpeg
ffmpeg version N-115551-g4037d5e103-20240603 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13.2.0 (crosstool-NG 1.26.0.65_ecc5e41)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240603
libavutil 59. 21.100 / 59. 21.100
libavcodec 61. 6.100 / 61. 6.100
libavformat 61. 3.104 / 61. 3.104
libavdevice 61. 2.100 / 61. 2.100
libavfilter 10. 2.102 / 10. 2.102
libswscale 8. 2.100 / 8. 2.100
libswresample 5. 2.100 / 5. 2.100
libpostproc 58. 2.100 / 58. 2.100
Universal media converter
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Thanks for the detailed report.

The issue seems to be that ffmpeg-normalize looks for the OS environment variable FFMPEG_PATH and expects it to point to the actual ffmpeg binary, i.e. C:\Program Files\FFMpeg\ffmpeg.exe rather than the directory containing it.

To fix this, please set the FFMPEG_PATH to C:\Program Files\FFMpeg\ffmpeg.exe.

This is a somewhat odd choice since, normally, PATH variables point to directories containing binaries. But undoing it would also mean breaking compatibility with existing scripts.

Alternatively, you may add your ffmpeg binary to the system PATH:

  • Open the Start Search, type in “env” and select “Edit the system environment variables”
  • In the System Properties window, click on the “Environment Variables” button
  • In the Environment Variables window, under System variables, find the PATH variable, select it, and click Edit
  • Click New and add C:\Program Files\FFMpeg to the list
  • Click OK to close all the windows

Ah, that works. Thanks.