slhck / ffmpeg-normalize

Audio Normalization for Python/ffmpeg
MIT License
1.28k stars 118 forks source link

Can't find ffmpeg.exe with ffmpeg_path set #258

Closed JonRFleming closed 5 months ago

JonRFleming commented 5 months ago

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'

slhck commented 5 months ago

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.

slhck commented 5 months ago

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

JonRFleming commented 5 months ago

Ah, that works. Thanks.