VIDEOIO ERROR: V4L
I get the following error when I try to initialise a videocapture with a url:
cv::VideoCapture cap = cv::VideoCapture( "http://www.example.com/vid" );
error:
VIDEOIO ERROR: V4L: device http://www.example.com/vid: Unable to query number of channels
There is nothing wrong with the videofile or access rights.
I recently recompiled ffmpeg with extra libs, and opencv 3.2 on ubuntu xenial, with the following configs:
ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-libmfx --enable-runtime-cpudetect --enable-gray --enable-vaapi --enable-vdpau --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libfdk-aac --enable-libtheora --enable-libvpx --enable-libwebp --enable-x11grab --cpu=native --enable-vaapi --enable-vdpau --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libwavpack --enable-libxvid --enable-libx264 --enable-libx265 --enable-openssl --enable-nvenc --enable-cuda --enable-omx --enable-libv4l2
opencv 3.2
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DWITH_LIBV4L=ON -DWITH_CLP=ON -DWITH_OPENCL=ON -DWITH_VA_INTEL=ON -DWITH_VA=ON ..
Could it be that I compiled opencv with VAor opencl?
EDIT: I tried recompiling opencv without the extra parameters and get the same issue:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DWITH_LIBV4L=ON -DWITH_CLP=ON ..
I might have fixed this with
Ok no the solution above simply silences the error, but will still get an empty stream if it opens successfully
will be 0
@ victor.dmdb you should fixed the bug by opening the video via ffmpeg, there is a another method to fix the question, the steps are as the following: 1. compile opencv with disabled v4l and enabled ffmpeg.
open the video without any flags(apiPreference).
cv::VideoCapture videoCapture("videos/0188_03_021_al_pacino.avi", cv::CAP_FFMPEG);