ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

FileNotFoundError: [WinError 2]

Open ghost opened this issue 4 years ago • 7 comments

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

ghost avatar Jul 01 '20 17:07 ghost

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

solaris7x avatar Jul 23 '20 12:07 solaris7x

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.

creativegamer03 avatar Oct 25 '20 07:10 creativegamer03

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

mbhurtel avatar Dec 16 '20 10:12 mbhurtel

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.

b3758163 avatar Jan 24 '23 04:01 b3758163

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

Alexqq11 avatar Jun 04 '23 19:06 Alexqq11

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

rheophile10 avatar Jun 10 '23 22:06 rheophile10

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??

RagingRift avatar Jul 01 '24 18:07 RagingRift