User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Using VLC to stream from the camera - Help needed

Thu May 16, 2013 12:50 pm

Hi all.
I've been working on this for the past few hours and, despite some success, have been unable to get it working. I now need to get back to work, so hopefully someone has a bright idea.

I'm doing the following:

raspivid -w 400 -h 300 -t 1000000 -o - | cvlc -vvv - --noaudio --no-sout-audio --sout '#standard{access=http,mux=ts,dst=:8090}'

Which *should* broadcast the video output from the camera on port 8090 and I should be able to then read that on my laptop by looking at http://<pi address>:8090

BUT, I'm getting the following error (ad nauseum) on the Pi:
[0x1f16f60] main input debug: Buffering 0%

It could be something to do with the way the standard input stuff works as the following _does_ work to stream a static file:
cvlc -vvv test.h264 --sout '#standard{access=http,mux=ts,dst=:8090}'


Does anyone have any ideas? Cos I'm all out!
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 4:43 pm

Hiya,

After much searching I managed to get this working using

raspivid -o - -t 99999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


its the ':demux=h264' that seemed to get things sorted.

This now lets me stream directly from the camera, over the network and to my PC running VLC!

Hope it works for you!

Now I just need to reduce the buffering to make it a bit more real time..

Leo

User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 5:52 pm

Thank you!!! I shall try it out right now!
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:05 pm

Hope it works for you!

I've got a stream running at http://109.145.254.207:8091/streaming/stream.m3u8 at the moment that can be watched via VLC.

See how long the RPi can stay up for if multiple people connect!

Leo
Last edited by LeoWhite on Sat May 18, 2013 9:09 pm, edited 1 time in total.

User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:11 pm

Hey look at that! A train just went past :-)
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:23 pm

recantha2 wrote:Hey look at that! A train just went past :-)
Heh, that's about all that does! Trains, birds and the occasional fox.

gotdatwmd
Posts: 4
Joined: Sat May 18, 2013 6:21 pm

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:24 pm

I used your revised command and tried opening a stream in a web browser (safari on mac) using http://myip:8090 and the browser just tried to constantly download the stream like it was a file. What am I doing wrong here?

gotdatwmd
Posts: 4
Joined: Sat May 18, 2013 6:21 pm

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:26 pm

I tried your revised command and when I opened up http://ipofpi:8090 in a web browser (safari on a mac) it just tried to endlessly download the stream like it was a file. tried it in firefox as well to no effect. What am I doing wrong here?

usmcguy
Posts: 10
Joined: Mon Mar 04, 2013 12:01 am

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:35 pm

LeoWhite wrote:Hiya,

After much searching I managed to get this working using

raspivid -o - -t 99999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


its the ':demux=h264' that seemed to get things sorted.

This now lets me stream directly from the camera, over the network and to my PC running VLC!

Hope it works for you!

Now I just need to reduce the buffering to make it a bit more real time..

Leo

Did you compile cvlc? Or did you get it from a disto repo?

ProgDrums
Posts: 10
Joined: Wed Apr 10, 2013 10:36 am

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:36 pm

LeoWhite wrote:Hiya,

After much searching I managed to get this working using

raspivid -o - -t 99999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


its the ':demux=h264' that seemed to get things sorted.
I've just tried that but get the error -bash: cvlc: command not found

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:41 pm

ProgDrums wrote:
LeoWhite wrote:Hiya,

After much searching I managed to get this working using

raspivid -o - -t 99999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


its the ':demux=h264' that seemed to get things sorted.
I've just tried that but get the error -bash: cvlc: command not found
Do you have VLC installed? you may need to do 'sudo apt-get install vlc' to install it.

ProgDrums
Posts: 10
Joined: Wed Apr 10, 2013 10:36 am

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:45 pm

D'oh! Thanks. I'm new to all of this.

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:47 pm

ProgDrums wrote:D'oh! Thanks. I'm new to all of this.
Not a problem! hope that sorts it for you.

ProgDrums
Posts: 10
Joined: Wed Apr 10, 2013 10:36 am

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 6:56 pm

Working perfectly now. Thanks again.

Is there a way to stop the feed timing out?

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:06 pm

ProgDrums wrote:Working perfectly now. Thanks again.

Is there a way to stop the feed timing out?
I think the only way is to increase the timeout. So put a few 9s in the timeout value (I'm using -t 9999999 at the moment)

User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:09 pm

The rtsp version works better than the http version. There's still a fair amount of distortion but it's a good 'other' way of getting streaming working.
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:12 pm

recantha2 wrote:The rtsp version works better than the http version. There's still a fair amount of distortion but it's a good 'other' way of getting streaming working.
Yes I found the rtsp version a bit better, unfortunately I can't get it through my firewall without exposing all the other ports on the RPi! So running a http stream for now!

User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:22 pm

My stream is now online at
http://86.136.128.196:8080
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:29 pm

recantha2 wrote:My stream is now online at
http://86.136.128.196:8080
Think I managed to get one or two frames before it locked up!

I notice my stream seems to be around 3 Mb/s so could be a little heavy on the network connection!

User avatar
recantha2
Posts: 246
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:34 pm

Ahhhh, mine's over wifi. Probably why I'm getting a few problems!
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 7:56 pm

recantha2 wrote:Ahhhh, mine's over wifi. Probably why I'm getting a few problems!
That might introduce some issues! I've got my RPi connected via Ethernet at the moment, haven't tried wireless yet.

momentum
Posts: 4
Joined: Sat May 18, 2013 7:54 pm

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 8:00 pm

I can't seem to get any streaming to work from my RPi.

NC fills the buffer then bombs out.

VLC says its casting over HTTP but I can't see the streams. I can however see the streams listed above.

Maybe a dumb question, when my RPi is on the same network as my PC do I use the Public IP of my Internet connection or my local IP for my RPi 192.168.xx.xx?

Also my putty session locks up after the 99999 timer finishes and I have to restart my RPi to reestablish a connection.

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 8:41 pm

momentum wrote:I can't seem to get any streaming to work from my RPi.

NC fills the buffer then bombs out.

VLC says its casting over HTTP but I can't see the streams. I can however see the streams listed above.

Maybe a dumb question, when my RPi is on the same network as my PC do I use the Public IP of my Internet connection or my local IP for my RPi 192.168.xx.xx?
You should use the local IP for your RPi in that case.

To get the stream working via the public IP of your internet connection you'd have to enable port forwarding in your router so map the external port to your Raspberry Pi.
momentum wrote: Also my putty session locks up after the 99999 timer finishes and I have to restart my RPi to reestablish a connection.
Haven't seen that myself, but lately I've been running my tests on MobaXterm (http://mobaxterm.mobatek.net/) as it has an X server built in (useful for running the VLC graphical interface)

momentum
Posts: 4
Joined: Sat May 18, 2013 7:54 pm

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 9:03 pm

Some more clues to what it going on... It seem that when I run the command to start streaming it kills my lan and USB ports on the RPi until I reboot it. This is why I was seeing it die in Moba and Putty. This is obviously why its not streaming also... Anyone else having this problem? Going to try to find another power supply.. maybe too much current draw.

LeoWhite
Posts: 131
Joined: Mon Apr 08, 2013 9:20 am
Contact: Website

Re: Using VLC to stream from the camera - Help needed

Sat May 18, 2013 9:05 pm

Well I've now gotten HLS working! So my new stream is at http://109.145.254.207:8091/streaming/stream.m3u8

and I launched it using

Code: Select all

raspivid -o -  -w 920 -h 540 -t 9999999 |  vlc -v -I "dummy" stream:///dev/stdin  :sout="#std{access=livehttp{seglen=10,delsegs=true,numsegs=5, index=/var/www/streaming/stream.m3u8, index-url=http://109.145.254.207/streaming/stream-########.ts}, mux=ts{use-key-frames}, dst=/var/www/streaming/stream-########.ts}" :demux=h264
Which is based on some examples found on the web and previously mentioned in these forums.

This does seem to consume a lot more CPU time than the raw HTTP/RTSP stream tho..

Leo

Return to “Camera board”

Who is online

Users browsing this forum: Bing [Bot] and 8 guests