Raspberry Pi: camera video stream to host
While playing with the raspberry pi camera I found it hard to know if the camera was working or trying to tweak settings. I was using raspivid -f to preview the video. This was limited with being open for 5 seconds ( can be adjusted using the -t flag and passing it seconds in milliseconds ). The solution was to open a streaming video from the raspberry pi and view it on my host ( mac ).
On the mac install mplayer ( I used brew )
brew install mplayer
Then run netcat on port 2222 ( or whatever other port you would like )
nc -l 2222 | mplayer -fps 200 -demuxer h264es -
Now that the netcat stream is listening, let’s start broadcasting that stream on the py ( note the IP of the client and the port we selected )
/opt/vc/bin/raspivid -t 0 -w 300 -h 300 -hf -fps 20 -o - | nc <IP-OF-THE-CLIENT> 2222
If all was done correctly a video should pop up on your mac with your camera.
Raspberry Pi camera help