Page 1 of 7

Using VLC to stream from the camera - Help needed

Posted: Thu May 16, 2013 12:50 pm
by recantha2
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!

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

Posted: Sat May 18, 2013 4:43 pm
by LeoWhite
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

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

Posted: Sat May 18, 2013 5:52 pm
by recantha2
Thank you!!! I shall try it out right now!

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

Posted: Sat May 18, 2013 6:05 pm
by LeoWhite
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

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

Posted: Sat May 18, 2013 6:11 pm
by recantha2
Hey look at that! A train just went past :-)

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

Posted: Sat May 18, 2013 6:23 pm
by LeoWhite
recantha2 wrote:Hey look at that! A train just went past :-)
Heh, that's about all that does! Trains, birds and the occasional fox.

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

Posted: Sat May 18, 2013 6:24 pm
by gotdatwmd
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?

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

Posted: Sat May 18, 2013 6:26 pm
by gotdatwmd
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?

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

Posted: Sat May 18, 2013 6:35 pm
by usmcguy
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?

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

Posted: Sat May 18, 2013 6:36 pm
by ProgDrums
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

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

Posted: Sat May 18, 2013 6:41 pm
by LeoWhite
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.

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

Posted: Sat May 18, 2013 6:45 pm
by ProgDrums
D'oh! Thanks. I'm new to all of this.

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

Posted: Sat May 18, 2013 6:47 pm
by LeoWhite
ProgDrums wrote:D'oh! Thanks. I'm new to all of this.
Not a problem! hope that sorts it for you.

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

Posted: Sat May 18, 2013 6:56 pm
by ProgDrums
Working perfectly now. Thanks again.

Is there a way to stop the feed timing out?

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

Posted: Sat May 18, 2013 7:06 pm
by LeoWhite
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)

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

Posted: Sat May 18, 2013 7:09 pm
by recantha2
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.

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

Posted: Sat May 18, 2013 7:12 pm
by LeoWhite
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!

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

Posted: Sat May 18, 2013 7:22 pm
by recantha2
My stream is now online at
http://86.136.128.196:8080

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

Posted: Sat May 18, 2013 7:29 pm
by LeoWhite
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!

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

Posted: Sat May 18, 2013 7:34 pm
by recantha2
Ahhhh, mine's over wifi. Probably why I'm getting a few problems!

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

Posted: Sat May 18, 2013 7:56 pm
by LeoWhite
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.

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

Posted: Sat May 18, 2013 8:00 pm
by momentum
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.

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

Posted: Sat May 18, 2013 8:41 pm
by LeoWhite
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)

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

Posted: Sat May 18, 2013 9:03 pm
by momentum
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.

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

Posted: Sat May 18, 2013 9:05 pm
by LeoWhite
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