In the process of using the ffmpeg module to edit video files i used the subprocess module
The code is as follows:
#trim bit
import subprocess
import os
seconds = "4"
mypath=os.path.abspath('trial.mp4')
subprocess.call(['ffmpeg', '-i',mypath, '-ss', seconds, 'trimmed.mp4'])
Error message:
Traceback (most recent call last):
File "C:\moviepy-master\resizer.py", line 29, in <module>
subprocess.call(['ffmpeg', '-i',mypath, '-ss', seconds, 'trimmed.mp4'])
File "C:\Python27\lib\subprocess.py", line 168, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
After looking up similar problems i understood that the module is unable to pick the video file because it needs its path, so i took the absolute path. But in spite of that the error still shows up. The module where this code was saved and the video file trial.mp4 are in the same folder.
mypath
! (and maybe use os.path.exists() for more checking). Edit: error is ambiguous and i'm not even sure if the problem is within ffmpeg. Is ffmpeg in your system-path? Can it be called from console (like you do here, no absolute path!)? – Detentionffmpeg
- if the error was that it couldn't find the input file, it would not come in a neat Python exception, but as an error message on standard error from ffmpeg. – Unnecessarychoco install ffmpeg
– Weevil