In Pycharm, I have correctly set up an environment with ffmpeg: the project interpreter C:\Users\XYZ\AppData\Local\Programs\Python\Python37\python.exe contains, among others, the package ffmpeg. I can see that in the menu Settings then Project then Project Interpreter.
I would want to use this environment when I execute the following command, so ffmpeg will be found and execute correctly:
subprocess.call(
['ffmpeg', '-i', 'XYZ/XYZ.webm', '-stream_loop', '-1', '-i', 'XYZ/XYZ.wav',
'-c:v', 'copy', '-shortest', '-fflags', '+shortest', '-max_interleave_delta', '100M',
'XYZ/XYZ.webm']
, cwd='C:/Users/XYZ/Desktop/ytg2/')
For the moment, however, the following error is triggered:
Traceback (most recent call last): File "C:/Users/XYZ/Desktop/ytg2/main.py", line 497, in , cwd='C:/Users/XYZ/Desktop/ytg2/') File "C:\Users\XYZ\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 323, in call with Popen(*popenargs, **kwargs) as p: File "C:\Users\XYZ\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in init restore_signals, start_new_session) File "C:\Users\XYZ\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child startupinfo) FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
Process finished with exit code 1
What should I do?
ffmpegis not installed or not on yourPATH, in French. - tripleeePATH? Pure speculation; I don't use PyCharm, or Windows. - tripleeeimport osand examineos.environ['PATH']in your script. If indeed it is incorrect, you can hardcode the path toffmpeg(which by now you should know, even if you aren't revealing it) or maybe pass an augmented path tosubprocess,call(), - tripleeeffmpegwhich is displayed by PyCharm which is basically urelated to the external binary programffmpeg. If the package is any good, you should probably use that instead of running theffmpegbinary as a subprocess. Compare to usingsubprocess.call(['echo'])vs Python's built-inprint. - tripleee