Page 1 of 1

Can I use VLC to stream the MJPEG stream?

PostPosted: Fri Dec 19, 2014 9:49 am
by SimonBirrell
Hi,

I'm building an interface to connect Scratch to the py_websockets_bot library (I'll share it on GitHub once it's finished). One command I want to be able to send from scratch is a broadcast that says "robot camera on". This would:

1) Start the camera streaming, using bot.start_streaming_camera_images()
2) Open a VLC window that would connect to the http / MJPEG stream from the bot

My question is how to do the second, ie. what command line options for VLC would I use?

I want to do it this way instead of involving a web browser (the controlling client is another Pi). I'm happy to use an alternative to VLC if there is one, but I don't want it to be a web browser (the project is for a 6 year old).

Thanks for any advice.

Simon

Re: Can I use VLC to stream the MJPEG stream?

PostPosted: Mon Dec 22, 2014 8:13 pm
by Alan
Hi Simon,

Welcome to the forum. :) Sorry for the delayed reply, I don't get notifications of posts awaiting approval and don't visit the forum regularly enough. :oops:

From the email you sent me on Saturday about other issues it sounds like you got the VLC thing to work? Very interested to know what performance you get out of this? If you have OpenCV installed then you could just write a program like one of the examples to display the camera stream in a new window, although I'm not sure how well the performance of my streaming code would compare.

Regards

Alan

Re: Can I use VLC to stream the MJPEG stream?

PostPosted: Thu Dec 25, 2014 1:01 pm
by SimonBirrell
Hi Alan,

I got Python to launch VLC (and kill any previous instances) and stream from the bot. Unfortunately it seems to hang, or maybe it's just too slow to really absorb the stream. I'm going to try changing the image size, if not I'll have a look at your OpenCV example.

Any other suggestions welcome.

Thanks!

Simon

Re: Can I use VLC to stream the MJPEG stream?

PostPosted: Fri Dec 26, 2014 11:24 pm
by Alan
Hi Simon,

Using a URL ending in /small_image/?action=stream will give a smaller resized camera image which should be less intensive, although the standard 640x480 stream should also not be a problem for the vast majority of computers. As a guide it definitely shouldn't be slower than whatever you see in the computer's browser.

I don't really have any experience using VLC though I'm afraid so can't give much advice there. Probably the OpenCV approach is the best one to follow. Let me know if you've got any specific error messages I can help you with.

Regards

Alan