Alec Armstrong
Posts: 3
Joined: Thu May 30, 2013 4:21 pm

Getting The Camera To Stream

Thu May 30, 2013 5:08 pm

I am currently stuck in my attempt to get my Pi's Camera to stream over my home (internet) network. I have been following the instructions from the below page:
http://www.raspberrypi.org/archives/tag/camera-board

On my Windows PC I have downloaded Netcat and MPlayer. I am typing into the PC the below line:
[Path to nc.exe]\nc.exe -L -p 5001 | [Path to mplayer.exe]\mplayer.exe -fps 31 -cache 1024 -

At the moment the Command Prompt appears to "hang" with the message:
Cache fill: 0.00% (0 bytes).

The below screen shot illustrates this
Image

My questions are:
(1.) Is the computer supposed to hang on 0.00%? Otherwise, how am I supposed to view the Pi Camera streams on the Windows PC?
(2.) Concerning the Pi itself - do all I need to do to stream from the Pi is to type:
raspivid -t 999999 -o – | nc [insert the IP address of the client] 5001
Does this command switch the camera on at all times (I note there is no red light being displayed)? Or does the Pi only stream at other times such as utilising the raspivid command to make other recordings?

Thank you for any comments!

suzimu
Posts: 6
Joined: Fri May 17, 2013 8:37 pm

Re: Getting The Camera To Stream

Thu May 30, 2013 7:42 pm

as far as i know the camera is activated and utilised using the raspivid and raspistill commands, it does not work autonomously 'out of the box'.

have you cleared netcat across your windows firewall? i found it needed to be allowed before i could stream to a local windows machine.the 0.00% cache would indicate no stream is arriving at the windows machine.

erikcf
Posts: 19
Joined: Thu May 23, 2013 4:17 am

Re: Getting The Camera To Stream

Thu May 30, 2013 10:34 pm

Personally, I prefer to make the Pi the netcat server and the PC the client so I don't have to deal with the firewall on the PC at all. Based on those sample commands:

On the Pi:
raspivid -t 999999 -o - | nc -l -p 5001

On the Windows PC:
[Path to nc.exe]\nc.exe [IP address of the Pi] 5001 | [Path to mplayer.exe]\mplayer.exe -fps 31 -cache 1024 -

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

Re: Getting The Camera To Stream

Fri May 31, 2013 10:00 am

Alec Armstrong wrote: (2.) Concerning the Pi itself - do all I need to do to stream from the Pi is to type:
raspivid -t 999999 -o – | nc [insert the IP address of the client] 5001
There is an issue with the command listed on the setup page. its using the wrong '-' value after the -o, so if you copy and paste the link it will write to a file called '–' instead of passing it to nc.

So instead of using

raspivid -t 999999 -o –

use

raspivid -t 999999 -o -

(The last dash is replaced with a 'minus' sign)
Alec Armstrong wrote: Does this command switch the camera on at all times (I note there is no red light being displayed)? Or does the Pi only stream at other times such as utilising the raspivid command to make other recordings?
!
The red light should only be on when the camera is actively in use. i.e. when the raspistill or raspivid application are being run.
With the above command raspivid should record around 16 minutes of video before stopping. You can increase that by adding a few more '9's to the -t value.

Alec Armstrong
Posts: 3
Joined: Thu May 30, 2013 4:21 pm

Re: Getting The Camera To Stream

Fri May 31, 2013 10:56 am

Thank you for all of your replies.

Erik you write:
by erikcf » Thu May 30, 2013 10:34 pm
Personally, I prefer to make the Pi the netcat server and the PC the client so I don't have to deal with the firewall on the PC at all. Based on those sample commands:

On the Pi:
raspivid -t 999999 -o - | nc -l -p 5001

On the Windows PC:
[Path to nc.exe]\nc.exe [IP address of the Pi] 5001 | [Path to mplayer.exe]\mplayer.exe -fps 31 -cache 1024 -
I have just attempted to do the above. However, when I try the above raspivid command line on my Pi I get the message:
"-bash: -p: command not found" followed by a list of usage commands.

So, is there an error in the code provided or have I done something incorrectly?

LeoWhite - thanks for the suggestion about the types of hyphens, but unfortunately that is not the problem here.

fsphil
Posts: 5
Joined: Thu Mar 14, 2013 8:55 am
Location: UK
Contact: Website

Re: Getting The Camera To Stream

Fri May 31, 2013 11:24 am

You can play the stream with VLC without netcat on the client side:

vlc tcp://<raspberry pi>:<port> :demux=h264

Seems to work better than mplayer.
-Phil

Alec Armstrong
Posts: 3
Joined: Thu May 30, 2013 4:21 pm

Re: Getting The Camera To Stream

Fri May 31, 2013 2:42 pm

fsphil - thanks for the idea of using vlc.

Are you stating that the Windows machine should use VLC (not the Pi)?

Also concerning this command line:
vlc tcp://<raspberry pi>:<port> :demux=h264
Does it go into the VLC as a network URL or is this going to be typed into the Pi as a command line?
How do you know what the <port> number is?

Thank you!

fsphil
Posts: 5
Joined: Thu Mar 14, 2013 8:55 am
Location: UK
Contact: Website

Re: Getting The Camera To Stream

Fri May 31, 2013 2:50 pm

This will be on your windows machine. You can run it from the command line, or in the VLC UI you can open the network stream with the tcp:// url - but you must click on the 'show more options' part to enter the demux argument. For example: http://i.imgur.com/zvBVKOX.png

Image

On Linux here but it's the same for windows.
-Phil

User avatar
Gnome
Posts: 3
Joined: Sat Dec 15, 2012 6:55 pm

Re: Getting The Camera To Stream

Fri Nov 08, 2013 5:58 pm

Many thanks for posting this, got my pi streaming nicely to my vlc on my windows machine. The only issue that I am seeing is that there is a 4 to 5 second delay in the stream, I have played around with a number of settings but nothing improvise the situation. Any suggestions ?
Regards

Gnome

User avatar
Gnome
Posts: 3
Joined: Sat Dec 15, 2012 6:55 pm

Re: Getting The Camera To Stream

Fri Nov 08, 2013 7:25 pm

PS - I have already set vlc to "lowest latency" in preference and experimented with options like :clock-jitter=0
Regards

Gnome

Return to “Camera board”