0

我使用django-videothumbs 视频字段是:

video = videothumbs.VideoThumbField(upload_to='videos', sizes=((125,125),(300,200),))

在上传,视频上传,但在缩略图创建我有这个错误:

异常值:列表索引超出范围异常位置:/library/videothumbs.py in generate_thumb,第 51 行

第 51 行:

for c in range(len(histogram[0])):
    ac = 0.0
    for i in range(n):
       ac = ac + (float(histogram[i][c])/n)
       avg.append(ac)

视频归档有什么问题?

编辑:print histogram我有:

sh: ffmpeg: command not found

但在终端:

FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
Mac OSX universal build for ffmpegX
configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --    disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
libavutil version: 49.0.0
libavcodec version: 51.9.0
libavformat version: 50.4.0
built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}...
Hyper fast Audio and Video encoder

提前致谢

4

1 回答 1

0

你检查过 的值histogram[0]吗?很可能histogram没有任何元素。

我将更改代码:

if len(histogram) > 0:
  for c in range(len(histogram[0])):
    ac = 0.0
    for i in range(n):
       ac = ac + (float(histogram[i][c])/n)
       avg.append(ac)
于 2012-05-10T07:36:37.043 回答