我正在使用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
提前致谢
答案 0 :(得分: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)