python - 在 python 中找不到可执行的“ffmpeg”
问题描述
我正在尝试使用 python 压缩视频,但是有一个错误,我无法理解如何解决它,所以你能帮我吗?我附上了一张图片,代码在这里输入图片描述
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!")
跑步,我明白了
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
解决方案
的包依赖项之一ffmpy
是ffmpeg
. 实际上ffmpy
是ffmpeg
. 要解决您的问题,请使用 pip 安装ffmpeg
.
推荐阅读
- jquery - 如何使用 replace() 在 Jquery 之前删除逗号和字符串?
- react-native - 使用 iOS Accessibility Inspector 检索到的 ReactNative 的 `accessibilityLabel` 和 iOS Label 是否相同?
- javascript - Javascript 库不适用于 React Native 发布版本
- postgresql - 如何选择不符合排除约束的行
- selenium - 有人可以建议我,如何为图像编写 xpath。请在下面找到 xpath 是否有效
- crystal-reports - Crystal Reports:在图表上突出显示最小值和最大值
- python - 无法运行python单元测试
- reactjs - 只想从文件对话框中选择目录路径
- windows - 巨大的内存分配导致 Windows 完全无响应
- angular - 点击时隐藏/显示建议