Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videocapture fails to open video in OpenCV 4.3.0 on ARMV7 #17391

Closed
4 tasks done
rokopi-byte opened this issue May 26, 2020 · 5 comments
Closed
4 tasks done

Videocapture fails to open video in OpenCV 4.3.0 on ARMV7 #17391

rokopi-byte opened this issue May 26, 2020 · 5 comments
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@rokopi-byte
Copy link

System information (version)
  • OpenCV => 4.3.0
  • Operating System / Platform => Raspbian Buster/ARMV7
  • Compiler => GCC 8.3
Detailed description

The following sample code to read a video fails with the following error. Opencv has been crosscompiled with inference engine using a docker, as the documentation says.

[ WARN:0] global /opencv/modules/videoio/src/cap_gstreamer.cpp (1759) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module matroskademux0 reported: Internal data stream error.
Error opening video stream or file
[ WARN:0] global /opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

Steps to reproduce

#include "opencv2/opencv.hpp"
#include <iostream>

using namespace std;
using namespace cv;

int main(){

  // Create a VideoCapture object and open the input file
  // If the input is the web camera, pass 0 instead of the video file name
  VideoCapture cap("../trackingexample/faceocc2.webm");

  // Check if camera opened successfully
  if(!cap.isOpened()){
    cout << "Error opening video stream or file" << endl;
    return -1;
  }

  while(1){

    Mat frame;
    // Capture frame-by-frame
    cap >> frame;

    // If the frame is empty, break immediately
    if (frame.empty())
      break;

    // Display the resulting frame
    imshow( "Frame", frame );

    // Press  ESC on keyboard to exit
    char c=(char)waitKey(25);
    if(c==27)
      break;
  }

  // When everything done, release the video capture object
  cap.release();

  // Closes all the frames
  destroyAllWindows();

  return 0;
}

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
@alalek
Copy link
Member

alalek commented May 26, 2020

GStreamer warning: Embedded video playback halted; module matroskademux0 reported: Internal data stream error.

This can't be fixed in OpenCV.
Ensure that GStreamer works on your system with used video stream.

@rokopi-byte
Copy link
Author

I'm sorry, it's related to webm format, matroska plugin is not working on raspbian buster.

@PatrickNa
Copy link

@roccopietrini how did you come to this conclusion? I am facing the same error on a Jetson Xavier. There I installed OpenCV 4.4.0 with Python 3.8 by means of pip.

@rokopi-byte
Copy link
Author

@PatrickNa Honesly I don't know precisely, I just followed this to get opencv installed on the raspberry, and matroska was not working, while other formats were working. I didn't manage to make it work, as it is something related to gstreamer, which I'm not familiar with.. I remember I tried installing gstreamer plugin packages without any luck. If you find out something, please write here. Thanks

@PatrickNa
Copy link

@roccopietrini I made it work.

This is what I have learned: When creating a VideoCapture instance one can, but does not have to, specify a 'Capture API'. In case it is not specified the system falls back to what is available. In my case, I have installed OpenCV with pip and the only capture API that was there was GStreamer, which expects a different syntax as with what I was familiar with. You can check which capture APIs are available by running the following lines in a python shell. The Video I/O section lists the information you are looking for.

import cv2
print(cv2.getBuildInformation())

Since I am more familiar with FFMPEG I compiled OpenCV including this API and was able to use VideoCapture as I knew it.
Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests

3 participants