Testing streaming from RPI camera to MPlayer on my PC

This is a test of streaming video from the Raspberry PI camera to my PC. I had to install netcat https://eternallybored.org/misc/netcat/ and MPlayer http://www.softpedia.com/get/Multimed...

Then I created a file on the raspberry containing this command:


raspivid -n -hf -vf -fps 25 -w 640 -h 480 -fl -t 0 -o - | nc 5001


raspivid creates a file with video in H264 format and I then pipe it to the nc command that sends it to my PC at port 5001.

In the PC I have a scipt that captures the information on port 5001 and sends it as a file to mplayer. It looks like this:

C:\netcat\nc64.exe -L -l -v -p 5001 | "C:\Program Files (x86)\MPlayer for Windows\Mplayer.exe" -fps 40 -cache 1024 -

The raspivid command creates a file at 25 fps, but I force the player to play it at 40 fps. So it will try to play at that speed until it reaches the end of the buffer. That way I get a relativley low latency. I think it is about 200ms.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GroG's picture

Great Video Mats, Very

Great Video Mats,

Very impressive speed (no latency), which for the most part I think is one of the most important qualities for a camera in Tele-robotics or computer vision.

I wonder if there is a container for the video stream.. AFIAK raw H264 can probably be played by mplayer, but might not be played by any browser.  

A quick way to find out is to host a HTML5 page with video tag on the raspi


I've found in chrome - if you don't specify the container format (leave type blank), it will try to figure it out..

You could install apache, make a quick html5 page and point the src of the video tag to ....   huh .. just looked at your raspivid command line - your specifying your pc's IP ?  So then is it rsp:// or rstp://  protocol ?

Ohhh... netcat to netcat to file cache .. :)   Wow !

Never seen that before 


Mats's picture


It's a very raw way to to it. Perhaps I can use a named pipe as input to OpenCV ?

Could be an interesting test.

Mats's picture

WTF, sorry i mean beeeeep.

The video was banned from Youtube....... I don't understand anything. Is thumbs up an obscene gesture or what......

Or is it the link to where I found the software using Google. Who should be blamed then. Perhaps the owners of YouTube aka Google...  Duh.


Mats's picture

I complained to YoyTube and now it's back

I complained to YouTube, and they put the video back again :-) 



GroG's picture

Was there music playing in

Was there music playing in the background ?   There are millions of lawyer bots crawling youtube - part of the big media lawyer swarm.  Evil thing .. they mindlessly scour Youtube for copyrighted music.   

They do audio signal matching - .. when a bot gets a match with copyrighted music the video is instantly banned.

If this is the case - you can remove the audio to allow it to stay on youtube.

Mats's picture

No music at all. Just me

No music at all. Just me speaking and showing streaming frrom the Raspberry Pi to my PC.

This is the message I got and it doesent' state anything about copyright violation. And it doesen't give me any clue to why it was removed. 

 The YouTube community flagged one or more of your videos as inappropriate. After reviewing the content, we’ve determined that the videos violate our Community Guidelines.

Grrrr ^ 2


GroG's picture

I thought the RasPi drivers

I thought the RasPi drivers for the camera module supported V4L2 .. if so, it shoudl "theoretically" be possible to get OpenCV to capture from the camera.  Of course, the latest version of MRL has binaries from JavaCV - and they do not compile for ARM-7 Linux :( 

But I think Alessandro already has compiled it ! ...  I'd be very curious to see if it worked...

There is a new service coming too ... WebCam, and I think its even higher likelyhood of working with the camera.

Mats's picture

Raspicam Worky

Yes. It works. Alessandro showed me how to do it, and I posted a comment in his blog.