gpt4 book ai didi

python - 在 python 中找不到可执行文件 'ffmpeg'

转载 作者:行者123 更新时间:2023-12-04 22:59:34 25 4
gpt4 key购买 nike

我正在尝试使用 python 压缩视频,但是有一个错误,我无法理解如何解决它,所以你能帮我吗?
我附上了一张图片和代码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!")

运行,我明白了
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 .事实上ffmpyffmpeg 的包装器.要解决您的问题,请使用 pip 安装 ffmpeg .

关于python - 在 python 中找不到可执行文件 'ffmpeg',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50222743/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com