ffmpeg-python
ffmpeg-python copied to clipboard
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'
I've found the problem, the ffmpeg library could not be found, if you're on macOS, just install it through homebrew: brew install ffmpeg
ffmpeg-python 0.1.17 python 3.6.9 ubuntu 18.4
inpath = '/home/project/demo/video/demo1.mp4'
def read_frame_as_jpeg(inpath, frame_num):
out, err = (
ffmpeg
.input(in_filename)
.filter('select', 'gte(n,{})'.format(frame_num))
.output('pipe:', vframes=1, format='image2', vcodec='mjpeg')
.run(capture_stdout=True)
)
return out
out = read_frame_as_jpeg(inpath, 2)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'
python read_frame_as_jpeg.py in.mp4 1
Traceback (most recent call last):
File "read_frame_as_jpeg.py", line 27, in
This works on MacOS, and I presume would also work on Ubuntu though I didn't test it. If you need to control the FFMpeg version or don't want to explain to your user how to install it on their computer you can also add the "cmd" parameter to the .run() command. (ffmpeg .input(inputFile) .output(outputFile, params) .run(cmd='/path_to/ffmpeg') )
python read_frame_as_jpeg.py in.mp4 1 Traceback (most recent call last): File "read_frame_as_jpeg.py", line 27, in out = read_frame_as_jpeg(args.in_filename, args.frame_num) File "read_frame_as_jpeg.py", line 20, in read_frame_as_jpeg .run(capture_stdout=True) File "/home/blake/anaconda3/lib/python3.6/site-packages/ffmpeg/_run.py", line 300, in run overwrite_output=overwrite_output, File "/home/blake/anaconda3/lib/python3.6/site-packages/ffmpeg/_run.py", line 272, in run_async args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream) File "/home/blake/anaconda3/lib/python3.6/subprocess.py", line 729, in init restore_signals, start_new_session) File "/home/blake/anaconda3/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'
Do you solve it?
on linux install ffmpeg sudo apt install ffmpeg this worked for me
This works on MacOS, and I presume would also work on Ubuntu though I didn't test it. If you need to control the FFMpeg version or don't want to explain to your user how to install it on their computer you can also add the "cmd" parameter to the .run() command. (ffmpeg .input(inputFile) .output(outputFile, params) .run(cmd='/path_to/ffmpeg') )
Yes, it's working on Ubuntu. In particular: video_stream,err = ( ffmpeg.input('TheBigBangTheory.mkv') .output('pipe:', format='rawvideo') .run(cmd='/path_to/ffmpeg',capture_stdout=True) )
You have to first install the ffmpeg program ..
Ffmpeg-python is just an API to the program.
apt-get install ffmpeg That is if you are using linux
On Tue, May 5, 2020, 11:00 AM Debin Meng [email protected] wrote:
This works on MacOS, and I presume would also work on Ubuntu though I didn't test it. If you need to control the FFMpeg version or don't want to explain to your user how to install it on their computer you can also add the "cmd" parameter to the .run() command. (ffmpeg .input(inputFile) .output(outputFile, params) .run(cmd='/path_to/ffmpeg') )
Yes, it's working on Ubuntu. In particular: video_stream,err = ( ffmpeg.input('TheBigBangTheory.mkv') .output('pipe:', format='rawvideo') .run(cmd='/path_to/ffmpeg',capture_stdout=True) )
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kkroening/ffmpeg-python/issues/251#issuecomment-623913956, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALXX3EHKM2YFFFNABFAZFWTRP7BTFANCNFSM4IK6LYTQ .
On Windows, you must set environment variable PATH.
- set it temporarily in python code.
import os
os.environ['path'] = 'C:\\data\\ffmpeg.exe'
# do someting
- set it permanently in cmd
setx "PATH" "%PATH%;C:\\data\\ffmpeg.exe" /m
A solution from CI test script
curl -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz &&
mkdir -p ffmpeg-release &&
tar Jxf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release &&
PATH=$(readlink -f ffmpeg-release):$PATH
Worked for me!
What version(s) of ffmpeg does this package work with? Would you accept a pull request that documents the ffmpeg dependency?
If I install ffmpeg + ffmpeg-python I see AttributeError: module 'ffmpeg' has no attribute 'input'
If I install only ffmpeg-python I see "FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
If I install ffmpeg + ffmpeg-python I see
AttributeError: module 'ffmpeg' has no attribute 'input'If I install only ffmpeg-python I see
"FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
I was in the exact same situation on windows.
-
Try to
reinstallitpip uninstall ffmpeg-python pip uninstall ffmpeg pip install ffmpeg-python -
Make sure you have set the
environment variable. (You can check in the terminal.)C:\Users\ru> ffmpeg ffmpeg version N-102166-g1ab74bc193 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10-win32 (GCC) 20210408 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-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 0.100 / 59. 0.100 libavformat 59. 0.100 / 59. 0.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.100 / 8. 0.100 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg' -
Rebootyour editor.
This is how I solved it😺
Is it possible to store FFmpeg output to EFS storage using python?
If I install ffmpeg + ffmpeg-python I see
AttributeError: module 'ffmpeg' has no attribute 'input'If I install only ffmpeg-python I see"FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'I was in the exact same situation on windows.
- Try to
reinstallitpip uninstall ffmpeg-python pip uninstall ffmpeg pip install ffmpeg-python- Make sure you have set the
environment variable. (You can check in the terminal.)C:\Users\ru> ffmpeg ffmpeg version N-102166-g1ab74bc193 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10-win32 (GCC) 20210408 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-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 0.100 / 59. 0.100 libavformat 59. 0.100 / 59. 0.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.100 / 8. 0.100 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg'Rebootyour editor.This is how I solved it😺
this solved it for me too
For windows 10: Download the ffmpeg.exe here https://ffmpeg.org/download.html extract the folder then change your directory to the bin file (which includes the .exe file) change your input video file path on line 85 (otherwise it will say file not found error) and run.
A solution from CI test script
curl -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && mkdir -p ffmpeg-release && tar Jxf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release && PATH=$(readlink -f ffmpeg-release):$PATHWorked for me!
On Linux, Worked for me too!
Hi, I am having this error too: FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg' I installed with HomeBrew, but the problem persists. I am guessing that I need to add the path to the bash file, but I do not know if that is the problem and how to do it. If someone can explain me how ti fix this, as detailed as possible (new into Mac), I would really appreciate it.
I also tried this: https://www.youtube.com/watch?v=H1o6MWnmwpY&ab_channel=RickMakes and did not work
well I solved it (I think) following this (https://stackoverflow.com/questions/40509002/ffmpeg-is-not-being-detected-by-spyder): "You need to install a copy of ffmpeg that can be recognized by Anaconda. Please run this command in a terminal to do that": conda install -c conda-forge ffmpeg
Hi 😁👋 This is how l solved my problem in Windows 🪟
We Open the Terminal in admin mode And execute the following command and click yes[y]
choco install ffmpeg
I've found the problem, the
ffmpeglibrary could not be found, if you're on macOS, just install it through homebrew:brew install ffmpeg
I have a error: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg' When running the python program, specify the path of ffmpeg, Environment variables: PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin This is how I solved it
ffmpeg-python 0.1.17 python 3.6.9 ubuntu 18.4
inpath = '/home/project/demo/video/demo1.mp4'def read_frame_as_jpeg(inpath, frame_num):out, err = ( ffmpeg .input(in_filename) .filter('select', 'gte(n,{})'.format(frame_num)) .output('pipe:', vframes=1, format='image2', vcodec='mjpeg') .run(capture_stdout=True) ) return outout = read_frame_as_jpeg(inpath, 2)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg'
If you are trying to use ffmpeg with Python, there is no easy or difficult solution. I have tried many ways mentioned here and beyond and simply ffmpeg does not work with Python3 and produces [Errno 2]. An alternative (and the best so far) for me has been executing command line FFmpeg command in python using subprocess.
well I solved it (I think) following this (https://stackoverflow.com/questions/40509002/ffmpeg-is-not-being-detected-by-spyder): "You need to install a copy of ffmpeg that can be recognized by Anaconda. Please run this command in a terminal to do that": conda install -c conda-forge ffmpeg
Spent a while trying to fix this, and this finally worked. Thank you!
I feel it is a problem with the IDE. I tried executing it in the terminal and it was successfully processed.
If I install ffmpeg + ffmpeg-python I see
AttributeError: module 'ffmpeg' has no attribute 'input'If I install only ffmpeg-python I see"FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'I was in the exact same situation on windows.
- Try to
reinstallitpip uninstall ffmpeg-python pip uninstall ffmpeg pip install ffmpeg-python- Make sure you have set the
environment variable. (You can check in the terminal.)C:\Users\ru> ffmpeg ffmpeg version N-102166-g1ab74bc193 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10-win32 (GCC) 20210408 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-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 0.100 / 59. 0.100 libavformat 59. 0.100 / 59. 0.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.100 / 8. 0.100 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg'Rebootyour editor.This is how I solved it😺
It worked for me too. Thanks for saving a lot of my time. I tried installing either or both ffmpeg and ffmpeg-python, but I had issues either way. One thing weird was that installing ffmpeg-python for the first time don't work, but reinstalling it for the second time works.