在WIndows中安装FFMPEG for Python

时间:2015-04-21 00:20:13

标签: python windows video ffmpeg

我试图使用this python视频转换器,我甚至无法运行测试。我在手册中读到我必须单独安装FFMPEG所以我做了(我在C:\创建了文件夹,环境变量"路径"并测试了它并且工作了)但仍然无法工作

当我运行命令时:

python setup.py test

我明白了:

Traceback (most recent call last):
  File "setup.py", line 51, in <module>
    packages=['converter'],
  File "C:\Python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 20, in run
    raise Exception('tests failed')
Exception: tests failed

当我运行此示例代码时:

from converter import Converter
c = Converter()

info = c.probe('test1.ogg')

conv = c.convert('test1.ogg', '/tmp/output.mkv', {
    'format': 'mkv',
    'audio': {
        'codec': 'mp3',
        'samplerate': 11025,
        'channels': 2
    },
    'video': {
        'codec': 'h264',
        'width': 720,
        'height': 400,
        'fps': 15
    }})

for timecode in conv:
    print "Converting (%f) ...\r" % timecode

我明白了:

Traceback (most recent call last):
  File "C:\Users\USER\worspace_pyth\cosa\prueba1.py", line 3, in <module>
    c=Converter()
  File "C:\Python27\converter\__init__.py", line 27, in __init__
    ffprobe_path=ffprobe_path)
  File "C:\Python27\converter\ffmpeg.py", line 345, in __init__
    raise FFMpegError("ffmpeg binary not found: " + self.ffmpeg_path)
converter.ffmpeg.FFMpegError: ffmpeg binary not found: ffmpeg

我无法理解我还需要做些什么来实现这个目标。谢谢你的帮助。

2 个答案:

答案 0 :(得分:0)

它看起来并不像100%Windows兼容:https://github.com/senko/python-video-converter/issues/1

我个人建议使用Cygwin:https://www.cygwin.com/

只需在Cygwin中安装ffmpeg和python,然后从那里开始。然后你有一个很好的POSIX-y环境来运行它和其他这样的软件。

答案 1 :(得分:0)

我能够在这里找到指示工作。至少在命令提示符下键入ffmpeg -version会返回结果。

http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/