Ask Your Question
0

Cannot open .mov file using cv2.VideoCapture in Python on Windows

asked 2013-05-08 00:44:54 -0600

PepsiCola gravatar image

I'm unable to open a .mov file using the stock Python OpenCV bindings from the main Windows distribution. The file opens fine in ffmpeg:

ffprobe version N-52045-g694fa00 Copyright (c) 2007-2013 the FFmpeg developers   built on Apr 12 2013 17:00:02 with gcc 4.8.0 (GCC)   configuration: --enable-gpl
--enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-li bopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo ra --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264  --enable-libxavs --enable-libxvid --enable-zlib   libavutil      52. 26.100 / 52. 26.100 libavcodec     55.  2.100 / 55.  2.100 libavformat    55.  2.100 / 55.  2.100 libavdevice    55.  0.100 / 55.  0.100 libavfilter     3. 53.101 /  3. 53.101 libswscale      2.  2.100 /  2.  2.100 libswresample   0. 17.102 /  0. 17.102 libpostproc    52.  3.100 / 52.  3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'FILE0005.mov':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2011-01-06 21:21:42   Duration: 00:15:14.05, start: 0.000000, bitrate: 15122 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 14987 kb/s, 29.97 f ps, 29.97 tbr, 90k tbn,
59.94 tbc
    Metadata:
      creation_time   : 2011-01-06 21:21:42
      handler_name    : Ambarella AVC
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
    Metadata:
      creation_time   : 2011-01-06 21:21:42
      handler_name    : Ambarella AAC

I downloaded OpenCV from https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.0/ and copied the build/python/2.7/cv2.pyd file to my python/lib/site-packages directory. The OpenCV samples work fine with .avi files, but I can't open my .mov file:

>>> c=cv2.VideoCapture('file0005.mov')
>>> c.isOpened()
False

I'm not sure what I need to do to get this to work - any advice would be much appreciated!

Thanks, Matthew

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-05-08 06:28:03 -0600

First of all I would suggest moving to openCV 2.4.5. Lately a lot of bugs concerning the included ffmpeg library and the VideoCapture element were fixed.

However, it could be possible that you will need to specify the encoding to be used by the VideoCapture element. This can be done by using the set functionality and using CV_FOURCC('C','Y','U','V') as parameter for the CV_CAP_PROP_FOURCC setting.

edit flag offensive delete link more
1

answered 2016-05-18 19:15:25 -0600

DanGoodrick gravatar image

Stackoverflow Solution: https://stackoverflow.com/questions/1...

For my machine, the opencv ffmpeg files were located here: C:\opencv\build\x64\vc12\bin

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-08 00:44:54 -0600

Seen: 23,192 times

Last updated: May 18 '16