简体   繁体   English

OpenCV(C ++)无法获得XVID视频文件帧速率

[英]OpenCV (C++) Can't get XVID video file framerate

I'm trying to get VideoCapture working with OpenCV. 我正在尝试让VideoCapture与OpenCV一起使用。 The video I'm trying to load is in XVID format (checked it with VideoCapture::get(CV_CAP_PROP_FOURCC) ). 我尝试加载的视频为XVID格式(已通过VideoCapture::get(CV_CAP_PROP_FOURCC)进行了检查)。 It works fine, but whenever I try to get the video framerate ( VideoCapture::get(CV_CAP_PROP_FPS) ) I get -nan . 它工作正常,但是每当我尝试获取视频帧速率( VideoCapture::get(CV_CAP_PROP_FPS) )时,我都会得到-nan

I've used the same video and the same code on another computer (at uni, they have a custom Debian installation) and I can confirm that the framerate info is there (it works fine there). 我在另一台计算机上使用了相同的视频和相同的代码(在uni上,它们具有自定义的Debian安装),并且我可以确认那里有帧速率信息(在那可以正常工作)。 I read somewhere that Ubuntu recently removed ffmpeg from their repositories (I use Linux Mint 17.2), so I installed the ffmpeg package from the ppa:kirillshkrogalev/ffmpeg-next repositories. 我读到某个地方,Ubuntu最近从其存储库中删除了ffmpeg(我使用Linux Mint 17.2),因此我从ppa:kirillshkrogalev/ffmpeg-next存储库中安装了ffmpeg软件包。 After that I recompiled OpenCV and installed again, without any change. 之后,我重新编译了OpenCV,然后再次安装,没有任何更改。

I'm using OpenCV 2.4.11 with C++ under Linux Mint 17.2. 我在Linux Mint 17.2下使用带有C ++的OpenCV 2.4.11。

Probably XVID is missing on your linux machine which is required by ffmpeg. ffmpeg所需的Linux计算机上可能缺少XVID。 Try installing XVID as below, it may help you. 尝试如下安装XVID,这可能会对您有所帮助。

cd /opt

wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz

tar xzvf xvidcore-1.3.2.tar.gz

cd xvidcore/build/generic

./configure --prefix="$HOME/ffmpeg_build"

make

make install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM