Page 1 of 1

Stream a collection of images (getting from camera)

Posted: 01 Apr 2011 03:13
by msdark
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!!

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

Posted: 01 Apr 2011 15:26
by Jean-Baptiste Kempf
What is the format of the frames?

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

Posted: 01 Apr 2011 17:56
by msdark
The format i can transform OpenCV frame/images in every format .. but the raw frames is a BGR data ...

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

Posted: 01 Apr 2011 18:46
by Jean-Baptiste Kempf
Maybe use imem for this.

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

Posted: 12 Apr 2011 16:52
by sokrat3s
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.

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

Posted: 12 Apr 2011 20:35
by plalonde
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"); }

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

Posted: 13 Apr 2011 10:53
by sokrat3s
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...

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

Posted: 07 Nov 2011 13:22
by carlesls
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.