frankman

博客园 首页 新随笔 联系 订阅 管理

这几天用cvCaptureFromAVI的函数,发现同样是.avi文件,有的可以读,有的不能读,而这些文件用wmp都是可以播放的。开始以为是帧率的问题,因为发现网上有个帖子说只能支持15fps的帧率,搞得我到处找video converter,想转换成帧率小的,后来发现好像不是这个问题。于是又找,在一个英文论坛上发现同样的问题,解答是:

Get a copy of GSpot to check the video codec.
If the file is compressed but no corresponding VFW codec on your system,
then cvCaptureFromAVI can not read it.
If the file is uncompressed, use mencoder to convert it
to opencv readable format, like this:
mencoder youravi.avi -ovc raw -vf format=i420 -o new.avi

发现可能是解码器没有装,下个GSpot分析了下,果然,打不开的文件检测是没有装解码器,而打的开的文件发现格式是BI_RGB Raw Bitmap,因此No Codec Required,所以能够打开。于是,马上在http://www.itime.cn/Soft/mp3soft/2523.html下了个XviD解码器,装好之后,在运行程序,果然可以读了。原来是这样啊,不过为啥windows media player可以播放了,难道说他的解码器是自带的并且不给别人用,呵呵!

第一次用GSpot,感觉不错!

 

--------------------------以下内容 2009年12月7日更新---------------------

建议大家用opencv 2.0,2.0不再出现以上的烦人的关于编解码器的问题!

 

 

posted on 2008-09-03 14:26  frankman  阅读(4899)  评论(0编辑  收藏  举报