Search code examples
c#opencvvideo-captureemgucv

Capture live video from youtube with OpenCV


I make vehicle detection program with OpenCV in C#. This program works well with already downloaded videos, but i want to use live streams from youtube. If I use

VideoCapture capture = new VideoCapture("https://www.youtube.com/v/qHqIjDoMYAk")

I get only a preview of the video.


Solution

  • You need to use the stream URL for Initializing the VideoCapture, not the webpage URL

    when initializing with the m3u8 this works.

    How to do this is already described on this question: How can I get the actual video URL of a YouTube live stream?

    It is the same method posted by Devstr in the comment, only an other post.