Stream a collection of images (getting from camera)

This forum is about all development around libVLC.
msdark
New Cone
New Cone
Posts: 2
Joined: 01 Apr 2011 03:02

Stream a collection of images (getting from camera)

Postby msdark » 01 Apr 2011 03:13

Hi (sorry for my poor english) ..
I have a question...
I have an application to capture from a camera (is written using OpenCV) take the frames and do something with them..
Now i need to add a streaming capability to this app so i think in libvlc ..but..

It's possible to push frames in some format (OpenCV, QtImage, gdk_pixbuf , etc) into a stream with libvlc ??...

any guideline or example of how can i do that??


The idea is make possible to see the result of the capture and processing frames on other devices .. may be create a stream to see using HTML5....

I read a lot about this and for now i was trying with gstreamer, this have a method to push data into a buffer (pipeline) to do the stream, but i want to try something else... it suppose that with gstreamer it's possible stream this buffer with RTP protocol .. but i can't getting work ...

libvlc will work for that???

Thanks in advance!!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream a collection of images (getting from camera)

Postby Jean-Baptiste Kempf » 01 Apr 2011 15:26

What is the format of the frames?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

msdark
New Cone
New Cone
Posts: 2
Joined: 01 Apr 2011 03:02

Re: Stream a collection of images (getting from camera)

Postby msdark » 01 Apr 2011 17:56

The format i can transform OpenCV frame/images in every format .. but the raw frames is a BGR data ...

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream a collection of images (getting from camera)

Postby Jean-Baptiste Kempf » 01 Apr 2011 18:46

Maybe use imem for this.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

sokrat3s
New Cone
New Cone
Posts: 7
Joined: 12 Apr 2011 16:48

Re: Stream a collection of images (getting from camera)

Postby sokrat3s » 12 Apr 2011 16:52

Hello everyone,
I am trying to do something similar. I would like to stream some H264 encoded byte stream (NAL unit format). Is that possible through libVLC? Is there a documentation/API about the streaming part of the library?

Thanks.

plalonde
New Cone
New Cone
Posts: 6
Joined: 11 Apr 2011 20:22

Re: Stream a collection of images (getting from camera)

Postby plalonde » 12 Apr 2011 20:35

Here is what I use; I protect the front/back-buffer switch with a mutex; my framebuffers are in rgb order, though VLC seems to want bgr. Endian mix-ups abound.

Code: Select all

//////////////////////////////////////////////// // libvlc setup //////////////////////////////////////////////// #include <vlc/vlc.h> void *vlc_lock_fn(void *data) { pthread_mutex_lock(&blurred_mutex); return p_rgb_blurred; } void vlc_unlock_fn(void *data) { pthread_mutex_unlock(&blurred_mutex); } libvlc_instance_t* vlc_inst; static const char* vlc_args[] = { "--codec", "invmem", "-vvvvv", "-I", "dummy", "--no-ipv6", "--ipv4", "--file-logging", "--drop-late-frames", "--skip-frames", "--nocolor", "--rtsp-caching=100", "--logfile", "/tmp/mylogfile",":no-sout-rtp-sap", ":no-sout-standard-sap", ":sout-keep", }; int init_video_out() { vlc_inst = libvlc_new(sizeof(vlc_args)/sizeof(vlc_args[0]), vlc_args); if(vlc_inst == NULL) { //your error handler } char swidth[50], sheight[50], slock[50], sunlock[50], sdata[50]; char sinput[10]; sprintf(swidth, ":invmem-width=%d", 640); sprintf(sheight, ":invmem-height=%d", 480); sprintf(slock, ":invmem-lock=%ld", (intptr_t)vlc_lock_fn); sprintf(sunlock, ":invmem-unlock=%ld", (intptr_t)vlc_unlock_fn); sprintf(sdata, ":invmem-data=%ld", (uintptr_t)NULL); const char* argvideo[] = { swidth, sheight, slock, sunlock, sdata }; sprintf(sinput, "fake:// :input-slave=alsa://"); libvlc_vlm_add_broadcast(vlc_inst, "myapp", sinput, "#transcode{vcodec=mp2v,vb=1200,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=rtp{sdp=rtsp://:5544/}}", sizeof(argvideo)/sizeof(argvideo[0]), argvideo, 1, 0); libvlc_vlm_play_media (vlc_inst, "myappt"); }

sokrat3s
New Cone
New Cone
Posts: 7
Joined: 12 Apr 2011 16:48

Re: Stream a collection of images (getting from camera)

Postby sokrat3s » 13 Apr 2011 10:53

Thank you plalonde. However, unfortunately if I don't have a documentation/API of the library I don't think your code can help me very much...

carlesls
Blank Cone
Blank Cone
Posts: 24
Joined: 17 Jun 2011 13:42

Re: Stream a collection of images (getting from camera)

Postby carlesls » 07 Nov 2011 13:22

Hi (sorry for my poor english) ..
I have a question...
I have an application to capture from a camera (is written using OpenCV) take the frames and do something with them..
Now i need to add a streaming capability to this app so i think in libvlc ..but..

It's possible to push frames in some format (OpenCV, QtImage, gdk_pixbuf , etc) into a stream with libvlc ??...

any guideline or example of how can i do that??


The idea is make possible to see the result of the capture and processing frames on other devices .. may be create a stream to see using HTML5....

I read a lot about this and for now i was trying with gstreamer, this have a method to push data into a buffer (pipeline) to do the stream, but i want to try something else... it suppose that with gstreamer it's possible stream this buffer with RTP protocol .. but i can't getting work ...

libvlc will work for that???

Thanks in advance!!
I happens to me too. It is a redundant issue on VLC and on this forum. I am using the emgu (a open cv warpper)... I need to capture frame by frame (the images from the rtsp). I can get the stream obviously from the IP camera or the web camera... but how do I get a queue of Images or stream of Image in memory (not saved in a folder) instead of visible video of the player.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests