kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
9.99k stars 886 forks source link

FileNotFoundError: [WinError 2] #392

Open ghost opened 4 years ago

ghost commented 4 years ago
import ffmpeg
from glob import glob

if glob("input.mp4"):
    stream = ffmpeg.input('input.mp4')
    stream = ffmpeg.hflip(stream)
    stream = ffmpeg.output(stream, 'output.mp4')
    ffmpeg.run(stream)

Even with this simple code, I always trigger this error. No matter if I use relative path or absolute.

Traceback (most recent call last): File "C:/Users/PC/Desktop/ZEncoder/test.py", line 6, in <module> ffmpeg.run(stream) File "C:\Users\PC\Desktop\ZEncoder\venv\lib\site-packages\ffmpeg\_run.py", line 313, in run process = run_async( File "C:\Users\PC\Desktop\ZEncoder\venv\lib\site-packages\ffmpeg\_run.py", line 284, in run_async return subprocess.Popen( File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

Windows 10 Python 3.8.3 ffmpeg-python 0.2.0

solaris7x commented 4 years ago

First check if you have ffmpeg binary installed under your system , Open powershell and type ffmpeg , it should look something like

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\abc> ffmpeg
ffmpeg version git-2020-06-20-29ea4e1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.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'
PS C:\Users\abc>

Seems like you have correctly installed ffmpeg-python package .

If the above works , try the below python script If the error is related to locating input files, try python pathlib module , Assuming your script and video file are in same directory/folder A basic example would be

from pathlib import Path
import ffmpeg

path= Path.cwd()

dummyFileIn = path.absolute().joinpath('input.mp4')
print(
    ffmpeg
    .probe(str(dummyFileIn.resolve()))
)

I am new to python , please point out any mistakes if I made any

creativegamer03 commented 4 years ago

maybe you've installed another module with the same name. try to reinstall it...

pip uninstall ffmpeg-python
pip uninstall ffmpeg
pip install ffmpeg

i had this problem because of ffmpeg installed. uninstalled both, reinstalled ffmpeg-python, and it's fixed.

mbhurtel commented 3 years ago

It worked for me with conda.

First delete all packages of ffmpeg

  1. pip uninstall ffmpeg-python
  2. pip uninstall ffmpeg

Then install again as follows:

  1. conda install -c menpo ffmpeg
  2. pip install ffmpeg-python
b3758163 commented 1 year ago

It worked for me with conda.

First delete all packages of ffmpeg 1. pip uninstall ffmpeg-python 2. pip uninstall ffmpeg

Then install again as follows: 1. conda install -c menpo ffmpeg 2. pip install ffmpeg-python

this worked for me, too.

Alexqq11 commented 1 year ago

I had this problem when install ffmpeg binary in power shell and try to use it from cmd without reload cmd. Old cmd shell doesn't update environment vars but in power shell i successefully use ffmpeg binary . just reload and try again

rheophile10 commented 1 year ago

I had this problem when install ffmpeg binary in power shell and try to use it from cmd without reload cmd. Old cmd shell doesn't update environment vars but in power shell i successefully use ffmpeg binary . just reload and try again

you might have to reopen and close vscode if you're operating from terminal in there as well

RagingRift commented 3 months ago

It worked for me with conda.

First delete all packages of ffmpeg 1. pip uninstall ffmpeg-python 2. pip uninstall ffmpeg

Then install again as follows: 1. conda install -c menpo ffmpeg 2. pip install ffmpeg-python

'conda' isn't a recognised command for me? Do i need to install it or something??