Hi there:
Hope you all are keeping well. I am trying to run the following python script in ‘post job script’ and I am getting this error
‘ffmpeg.exe’ is not recognized as an internal or external command, operable program or batch file.
I have made sure the FFmpeg plugin has the right path in Deadline. Only when give the absolute path to ffmpeg it executes without any error ?
#----------------------------------------------------------------------
import subprocess
import sys
def main( *args ):
sys.path.append(r’C:\ffmpeg4.4.4’)
print(sys.path)
try:
result = subprocess.run([‘ffmpeg.exe’, ‘-version’], shell=True, text=True, check=True)
print(“ffmpeg version:”, result.stdout)
except subprocess.CalledProcessError as e:
print(“Error during execution:”, e)
return
Regards
/Biju
You’re not using the FFMPEG application plugin in this example - so that’s not going to help out here.
Does sys.path.append want (r'C:\ffmpeg4.4.4\')
instead?
Since you’ve got the ffmpeg application plugin set up, have you tried submitting jobs through the Monitor’s Submit → Processing → FFMPEG submitter?
Hello Justin_B:
Thanks for the response. I was able to use FFMPEG submitter to submit a job and the FFMPEG used the plugin specified path to execute the ffmpeg command. But how do I use the ffmpeg to execute in post job script python script ?
Regards
/Biju
Should be something like (writing from memory, so needs checking)
executable = RepositoryUtils.GetPluginConfig("FFMPeg").GetConfigEntry("FFMPEG_Executable")
subprocess.run([executable, ...])
...
Hello Mois:
Thanks for the code will try, but I have a created a executable that call the ffmpeg, considering that the ffmpeg path is added to the windows environment variable PATH. On a windows command prompt the .exe gets executed without any error, but when called in Deadlline the error is ffmpeg.exe’ is not recognized as an internal or external command ?
Regards
/Biju
You either have to invoke the executable by its full path, or the directory that contains it must be in the PATH
variable.
I suspect the environment is not what you expect in the post job script, or you entered the path to the exe, instead of its directory.
Hello Mois:
Specifying the full path of the ffmpeg in the .exe works. But in linux specifying without the absolute paths works.
Thanks
/Biju
That’s because on Linux the location of ffmpeg is in PATH by default, which is probably /usr/bin
.
On Windows it’s slightly more complicated, and installers add programs to PATH.