Open and read avi files with OpenCV - Ubuntu

随声附和 提交于 2019-12-05 20:26:32

I finally managed to solve my problem.

What I did :

  • try to open some video to finally find one that would work. Fortunately it only took me 3 videos to find one that work.
  • check the codec with VLC. It is MPEG-4 XVID.
  • use mencoder to convert the file I wanted to read to XVID:

    sudo mencoder myFile.avi -ovc lavc vcodec=mpeg4:mbd=2:cbp:trell:vbitrate=300 -ffourcc XVID -o test.avi

I also switched to old C function cvCaptureFromFile(). I will go back to C++ interface to make sure it was indeed a codec issue, but I am pretty sure it was ([EDIT] it was a codec issue).

What did not work :

  • recompile OpenCV with Qt support enabled
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!