import ffmpeg
import os
file1 = 'input.avi'
file2 = 'output.avi'
print(os.path.isfile(file1)) #True
stream = ffmpeg.input(file1)
stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream, file2)
print(stream.get_args())
ffmpeg.run(stream) #FileNotFoundError: [WinError 2] The system could not find the specified file.
Here is the print:
['-i', 'input.avi', '-filter_complex', '[0]hflip[s0]', '-map', '[s0]', 'output.avi']
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Make sure ffmpeg is installed and on your system path. Note that ffmpeg-python does _not_ try to automatically install ffmpeg. It's simply a python _wrapper_ for ffmpeg, and it's up to you to make sure it's installed in whatever way makes sense for how you're using it.
We should keep this in mind though, that users may see unexpected error messages if ffmpeg can't be found. It should probably either be in the docs, or print a more helpful error message. Thanks for reporting.
Please let me know if this fixes your issue.
Problem solved. Thank you for your help!
An error message like 'ffmpeg is not installed' cound be very helpful for beginners.
I agree! For a minute, I thought that this package would make ffmpeg avaliable behind the scenes. Not a problem to install it though, just pointing that a more informative message would be better.
Thanks for the suggestion. I'll try to add a more helpful error message if I can find time. PRs are welcome as well.
Is this still the case:
Note that ffmpeg-python does not try to automatically install ffmpeg.
I installed ffmpeg-python first
run in the error
installed than ffmpeg
run my python code and got the error that ffmpeg does not have a ".input(...)" function.
I was forced to uninstall both and re-install ffmpeg-python.
But have now the same issue. "File not found"
But the file exists under the given path.
I uninstalled both.
Installed first ffmpeg than ffmpeg-python.
run the code from @tossorrow
and got the same error.
In Visual Studio Code: conda / Python 3.8.5 / plus the following packages:
scikit-learn
seaborn
scipy
scikit-image
numpy==1.18.*
matplotlib
pandas
openpyxl
keract
opencv-python
pygame
gym
pyqt5
pylint
flake8
mypy
isort
black
autopep8
pre-commit
Yes, I am in the correct conda envrioment.
I am really angry. Why?
I took my one and a half day to figure out why I get the "File not found" error.
A simple, short explanatory text in your "ReadMe.md" would have saved me that.
And certainly not just me.
As an aside, this would make this repository a lot more professional.
So please add something like these to your "Readme.md":
Note that ffmepg-Python wrapes the orignal ffmpeg.
Please make sure that the original ffmpeg is installed and
(in Windows) the system %Path% variable is set to the "...\ffmepg\bin" directory.
Then you can install ffmepg-Python via
pip install ffmepg-python
Most helpful comment
Problem solved. Thank you for your help!
An error message like 'ffmpeg is not installed' cound be very helpful for beginners.