Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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