Receiving a VLC video stream with OpenCV

This forum is about all development around libVLC.
alb84
Blank Cone
Blank Cone
Posts: 29
Joined: 16 Dec 2009 15:40

Receiving a VLC video stream with OpenCV

Postby alb84 » 17 Dec 2009 10:15

Hi everybody, I posted this question in this section of the forum because I could not figure out which was the most proper section to post it.

My problem is that I have a VLC video stream from a VLC server, and I'd like to receive the stream and do some real time processing with OpenCV.
OpenCV highlevel API can only manage video from files stored on file system or from capture devices but there is no way to manage a VLC video stream.
Which is the best solution you can advise? Possibly the easiest and quickest one.

I looked if it was possible to virtualize a dummy video capture device to use as a VLC client output and as a OpenCV input but I found no solutions.
My next step is to download the VLC source and modify it in order to get the raw RGB data ready to be visualized on the screen and pass it to the OpenCV application.
I already snooped around the source tarball but I did not figure out where I can add the code to get the raw RGB data. I hope you can help me, or maybe you can advise me some other solutions more simple and comfortable.
I've seen there is a libVLC API which seems to be done for these problems but I only found a call to take a snapshot of the current video frame on a file and I found no useful example to do what I need.
Any help / reference / tutorial / sample code is welcome!
Thanks

nimport nawak
New Cone
New Cone
Posts: 7
Joined: 07 Dec 2009 11:43

Re: Receiving a VLC video stream with OpenCV

Postby nimport nawak » 21 Dec 2009 11:10

Have a look here :
viewtopic.php?f=32&t=68816

You will have to transform your image in ipl instead of QPixmap but it shouldn't be a big deal

mohit839
New Cone
New Cone
Posts: 7
Joined: 27 Apr 2009 13:12

Re: Receiving a VLC video stream with OpenCV

Postby mohit839 » 28 Dec 2009 18:56

Were you able to do the OpenCV processing as mentioned in your earlier post? I am trying to do something similar - all I have got so far is the QT code from http://forum.qtfr.org/viewtopic.php?pid=65969. They seem to show how to access raw data using vmem.

Please do let me know if you come across something more concrete.

mighty_scoop
New Cone
New Cone
Posts: 5
Joined: 10 Feb 2010 16:10

Re: Receiving a VLC video stream with OpenCV

Postby mighty_scoop » 11 Feb 2010 12:26

Hi there,

are there any news in this topic ? Does anybody managed to parse a stream/video/image from vlc to opencv ? I would be very grateful for any help.

Greetings

alb84
Blank Cone
Blank Cone
Posts: 29
Joined: 16 Dec 2009 15:40

Re: Receiving a VLC video stream with OpenCV

Postby alb84 » 24 Feb 2010 10:44

i succesfully integrated libVLC and OpenCV, you just need to create an image and then tell libVLC where to write the data...

Code: Select all

// Allocating the space for the structure context = ( struct ctx* )malloc( sizeof( *context ) ); // Allocating the video buffer //context->pixels = ( unsigned char* )malloc( ( sizeof( *( context->pixels ) ) * VIDEO_WIDTH * VIDEO_HEIGHT ) * 4 ); context->img=cvCreateImage(cvSize(VIDEO_WIDTH, VIDEO_HEIGHT), IPL_DEPTH_8U, 4); context->pixels=(unsigned char *)context->img->imageData;
Then call libvlc using the vmem output as shown in the example posted above and available at
http://gitorious.org/vmem-example/vmem- ... ees/master

pv123
New Cone
New Cone
Posts: 2
Joined: 01 Jul 2012 16:17

Re: Receiving a VLC video stream with OpenCV

Postby pv123 » 01 Jul 2012 16:20

Hii alb84,

Can you please share the code where you integrated libvlc and opencv?

Thanks.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 4 guests