After pulling the latest version, I get an errro when trying to run the YoloV2 demo on a video while (which previously ran just fine):
video file: Videos/Office-Parkour.mp4
Unable to stop the stream: Inappropriate ioctl for device
(darknet:26256): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed
OpenCV Error: Unspecified error (GStreamer: cannot link color -> sink
) in cvCaptureFromCAM_GStreamer, file /home/brandonjabr/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp, line 792
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
/home/brandonjabr/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:792: error: (-2) GStreamer: cannot link color -> sink
in function cvCaptureFromCAM_GStreamer
Couldn't connect to webcam.
: Success
darknet: ./src/utils.c:253: error: Assertion `0' failed.
Aborted (core dumped)
When using the webcam instead of a video file, it still works fine. Is this due to an OpenCV error?
Thanks!
Did you check Opencv compilation options (OCV_OPTION) for Gstreamer support?
@rperrones Good call, I reinstalled all Gstreamer modules as instructed on their website, I now get a new error:
video file: Videos/Office-Parkour.mp4
Unable to stop the stream: Inappropriate ioctl for device
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Segmentation fault (core dumped)
Should I recompile OpenCV 3.2 and try again?
Thanks for your help, really appreciate it
Yes, it's a good idea... but now try to enable support for your Gstreamer version, before to start the compilation. Maybe others options like ffmpeg need to be enabled. The first compilation step will be checking all options that your platform has installed.
@rperrones
I was able to resolve the issue by reinstalling all neccessary gstreamer-0.10 modules and including the cmake flag -D WITH_GSTREAMER_0_10=ON when compiling OpenCV 3.2. Thanks for your tip!
Great!!
Hi,
I have the same problem when I want to run my own video; I could run the webcam. I do appreciate if you explain how you installed gstreamer-0.10 etc. This is the first time someone mention it. I tried many things but still not working.
@zmoayed
Had the exact same error, just got it fixed:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-devsudo apt-get install ffmpegcmake command, ensure that you add the WITH_GSTREAMER & WITH_FFMPEG flags. Here's the command I ran:cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON ..make.This should resolve any errors related to the "Couldn't connect to webcam."
Loading weights from yolov3.weights...
seen 64
Done!
video file: small.mp4
GStreamer: Error opening bin: unexpected reference "small" - ignoring
Couldn't connect to webcam.
: No such file or directory
assertion "0" failed: file "./src/utils.c", line 210, function: error
Aborted (стек памяти сброшен на диск)
What is the problem? I'm noob, please help.
OS: Windows 10
@zmoayed
Had the exact same error, just got it fixed:
- Install gstreamer modules:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev- Install ffmpeg:
sudo apt-get install ffmpeg- Build & install OpenCV:
https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#getting-the-latest-stable-opencv-version
Make sure you get the latest version of OpenCV (3.4.0 right now).
When you run thecmakecommand, ensure that you add the WITH_GSTREAMER & WITH_FFMPEG flags. Here's the command I ran:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON ..
OpenCV will take a while tomake.This should resolve any errors related to the "Couldn't connect to webcam."
@vsouda
I have tried as you said, but the same error:
Loading weights from backup/yolov3_final.weights...Done!
video file: test_video/0.avi
Unable to stop the stream: Invalid argument
Couldn't connect to webcam.
: Invalid argument
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped).
@zmoayed
Had the exact same error, just got it fixed:
- Install gstreamer modules:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev- Install ffmpeg:
sudo apt-get install ffmpeg- Build & install OpenCV:
https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#getting-the-latest-stable-opencv-version
Make sure you get the latest version of OpenCV (3.4.0 right now).
When you run thecmakecommand, ensure that you add the WITH_GSTREAMER & WITH_FFMPEG flags. Here's the command I ran:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON ..
OpenCV will take a while tomake.This should resolve any errors related to the "Couldn't connect to webcam."
@vsouda
I have tried as you said, but the same error:
Loading weights from backup/yolov3_final.weights...Done!
video file: test_video/0.avi
Unable to stop the stream: Invalid argument
Couldn't connect to webcam.
: Invalid argument
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped).
Did you find the solution?
Unable to stop the stream: Inappropriate ioctl for device
Couldn't connect to webcam.
: Inappropriate ioctl for device
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped)
服务器运行报错
Have the same error using ensenso camera
Unable to stop the stream: Invalid argument
Couldn't connect to webcam.
: Resource temporarily unavailable
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped)
I have the same error and I found hsocasnavarro's solution here works for me:
UBUNTU 14.04 cheese booth not detect webcam
to check if your camera device is detected:
$ ls -ltrh /dev/video*
crwxrwxrwx+ 1 root video 81, 1 May 25 11:58 /dev/video1
crwxrwxrwx+ 1 root video 81, 0 May 25 11:58 /dev/video0
to change permissions:
chmod 777 /dev/video*
Most helpful comment
@zmoayed
Had the exact same error, just got it fixed:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-devsudo apt-get install ffmpeghttps://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#getting-the-latest-stable-opencv-version
Make sure you get the latest version of OpenCV (3.4.0 right now).
When you run the
cmakecommand, ensure that you add the WITH_GSTREAMER & WITH_FFMPEG flags. Here's the command I ran:cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON ..OpenCV will take a while to
make.This should resolve any errors related to the "Couldn't connect to webcam."