I have a video file here /data/out.mp4 and its copy /data/out. I'm on Osx Sierra with Xcode 8.
Open video with mp4 extension is ok but get error with no extension or any other format.
I tryed opencv 2.4 and latest 3.2 from git. Compiled with ffmpeg release/2.0 and also tryed release/3.0
With opencv version 3.2:
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.2.0-dev'
>>> cv2.__file__
'/Users/johndoe/work/myproject/venv/local/lib/python2.7/site-packages/cv2.so'
If video have extension:
>>> v=cv2.VideoCapture('/data/out.mp4')
>>> v.get(cv2.CAP_PROP_FRAME_COUNT)
61117.0
If video have no extension:
>>> v=cv2.VideoCapture('/data/out')
VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!
>>> v.get(cv2.CAP_PROP_FRAME_COUNT)
0.0
My FFmpeg configure:
./configure --prefix=/usr \
--bindir=/usr/local/bin/ \
--shlibdir=/usr/lib64 \
--datadir=/usr/share/ffmpeg \
--incdir=/usr/include/ffmpeg \
--libdir=/usr/lib64 \
--mandir=/usr/share/man \
--extra-cflags='-O2 -g' \
--extra-version=rpmfusion \
--enable-bzlib \
--enable-nonfree \
--enable-libopenjpeg \
--enable-libx264 \
--enable-avfilter \
--enable-postproc \
--enable-pthreads \
--disable-static \
--enable-shared \
--enable-gpl \
--enable-runtime-cpudetect \
--arch=x86_64
My opencv CMAKE:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/Users/johndoe/work/myproject/venv/local/ \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_PACKAGES_PATH=/Users/johndoe/work/myproject/venv/lib/python2.7/site-packages \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D PYTHON_EXECUTABLE=/Users/johndoe/work/myproject/venv/bin/python \
-D WITH_CUDA=OFF ..
I tryed various other formats reencoding my original video (ie: ffmpeg -i out.mp4 out.asf) :
>>> v=cv2.VideoCapture('/data/out.avi')
VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!
>>> v=cv2.VideoCapture('/data/out.flv')
VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!
>>> v=cv2.VideoCapture('/data/out.asf')
VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!