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

FileNotFoundError: [WinError 2] The system cannot find the file specified

Open RagingRift opened this issue 1 year ago • 4 comments

I've imported ffmpeg-python and had the error but i tried installing ffmpeg as well but the issue still persists. I have the input file in the same directory as the python file so it should be able to find it? I even pasted in the whole directory but it still didn't work.

I've looked at posts on here with the same issue but the solutions they gave were either not descriptive enough, confusing, or didn't work. I am extremely new to python, programming and computers in general so maybe i don't understand things people say on here

Here is my code currently:

import ffmpeg

source = "input.webm"
output = "output.ts"

stream = ffmpeg.input(source)
stream = ffmpeg.output(stream, output)
ffmpeg.run(stream)

RagingRift avatar Jul 01 '24 18:07 RagingRift

Try ffmpeg.input(source).output(output). The stream argument is self on the second config line.

joe-saronic avatar Jul 02 '24 15:07 joe-saronic

If I try this:

source = r'C:\Users\Freelancer-xxx-05\Desktop\HRO_FD_reduced_v004_[00000-03999]_Difference_4.mp4' output = r'C:\Users\Freelancer-xxx-05\Desktop\mpegger_test\mac.mp4' ffmpeg.input(source).output(output) ffmpeg.run()

I get:

Traceback (most recent call last): File "C:\Users\Freelancer-xxx-05\PycharmProjects\pythonProject.venv\ffmpegtest.py", line 6, in ffmpeg.run() TypeError: run() missing 1 required positional argument: 'stream_spec'

Process finished with exit code 1

I was running into the same thing as OP...really not sure what is going on as it all seems to be good until this point.

pgoskiFLT avatar Jul 04 '24 14:07 pgoskiFLT

Ok, so I found the issue and it is user error. When setting the ENV variable it must be set in the "Path" variable select this, then click edit...it will open a new window. Click add, then add the path to the ffmpeg.exe (DO NOT include executable, only add the path) Once this has been done restart command line or powershell, and try again. This worked for me.

pgoskiFLT avatar Jul 05 '24 01:07 pgoskiFLT

Take the ffmpeg.exe file and put it in the python environment which has python.exe it will work

Abinesh78 avatar Sep 18 '24 12:09 Abinesh78