【发布时间】:2017-04-08 16:10:40
【问题描述】:
我在 MacOSX 上使用 Python 3.6。我想使用 FFmpeg 作为 Python 子进程。使用 OSX 嵌入式 Python 2.7 时一切正常,但使用 3.6 时,这不起作用。
我收到一条错误消息,因为它没有找到 FFmepg:
raise FFExecutableNotFoundError("Executable '{0}' not found".format(self.executable))
ffmpy.FFExecutableNotFoundError: Executable 'ffmpeg' not found
我尝试使用 ffmpy,但直接调用 FFmpeg 也得到了相同的结果:
>>> from subprocess import call
>>> call(["ffmpeg"])
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
call(["ffmpeg"])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1326, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
我安装了 FFmpeg 库。通过终端使用 Brew。它安装得很好,但只有 Python 2.7 可见,3.6 不可见。
从终端调用它是有效的:
$ ffmpeg
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
我(还不是)Linux 专家,但我认为 3.6 缺少找到 FFmpeg 的路径。
有解决这个烦人问题的线索吗?
【问题讨论】:
-
也许可以尝试使用您想要的
ffmpeg二进制文件的绝对路径。 -
感谢您的回答。现在可以了。没错,我只是在调用时添加了真正的FFmpeg位置。
-
我不认为它是重复的,但这是一个密切相关的问题,除了 Linux:stackoverflow.com/questions/50798198/…
标签: macos python-2.7 python-3.x ffmpeg