Ahmed Mohamed
Ahmed Mohamed

Reputation: 21

Executable 'ffmpeg' not found in python

I'm trying to compress a video using python but there is an error that I can't understand how to solve it, so can you help me please ? I have attached an image and the code enter image description here

import ffmpy

input_name = input("Enter name of input file: ")
crf = int(input("Enter constant rate factor between 18 and 24: "))
output_name = input("Enter output file name: ")
inp = {input_name: None}
outp = {output_name: '-vcodec libx264 -crf %d'%crf}     #video  codec and compression rate
ff = ffmpy.FFmpeg(inputs=inp, outputs=outp)             #creates an FFmpeg object
print(ff.cmd)                                           #just to verify that it produces the correct ffmpeg command
ff.run()                                                #does the compression
print("done!")

Running, I get

Enter name of input file: newproject.mp4
Enter constant rate factor between 18 and 24: 20
Enter output file name: "com.mp4"
ffmpeg -i newproject.mp4 -vcodec libx264 -crf 20 com.mp4
Traceback (most recent call last):
  File "E:/ahmed/Installed Programs/PyCharm/SelecedTopics/bonus2.py", line 10, in <module>
    ff.run()                                                #does the compression
  File "E:\ahmed\Python\Anaconda\lib\site-packages\ffmpy.py", line 99, in run
    raise FFExecutableNotFoundError("Executable '{0}' not found".format(self.executable))
ffmpy.FFExecutableNotFoundError: Executable 'ffmpeg' not found

Process finished with exit code 1

Upvotes: 2

Views: 6689

Answers (1)

Randy Mi
Randy Mi

Reputation: 21

One of the package dependencies of ffmpy is ffmpeg. In fact ffmpy is a wrapper for ffmpeg. To fix your issue use pip to install ffmpeg.

Upvotes: 2

Related Questions