1

我有兴趣在 UBUNTU 中使用 python 脚本查找视频文件(常用格式)的持续时间。我找到了代码:

def getLength(filename):
result = subprocess.Popen(["ffprobe", filename],
stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
return [x for x in result.stdout.readlines() if "Duration" in x]

但它在我的 UBUNTU BOX 上不起作用可能是因为缺少 ffprobe 或其他原因,我收到以下错误:

File "leng.py", line 8, in getLength
stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

我只想要持续时间,所以有没有更简单的方法或如何使上述代码工作有没有简单的方法?

4

2 回答 2

2

只需安装 ffmpeg

sudo apt-get install ffmpeg
于 2014-02-14T20:00:52.243 回答
0

Ubuntu 默认带有 avconv 而不是 ffmpeg(ffmpeg 只是 avconv 的包装器)。

看来您都没有安装。

于 2014-02-14T23:44:33.693 回答