Pedulla
Posts: 5
Joined: Tue Jan 29, 2013 6:27 pm

ssh-netcat(nc)-mplayer

Wed May 29, 2013 5:49 am

Hi All,
Using the basic tutorial in this original post, http://www.raspberrypi.org/archives/3890 , I've been able to stream what I assume is h264 video from my raspi to my linux desktop on the local network with stunningly low bandwidth requirements.

My Linux Desktop (CLI 1):

Code: Select all

nc -l -p 5001 | mplayer -fps 11 -cache 1024 -
Raspi Console (CLI 2): After ssh login (CLI 2):

Code: Select all

raspivid -fps 10 -w 640 -h 360 -vf -hf -t 999999 -o - | nc MY.DESK.IP 5001
After the buffer fills, mplayer draws a window and beautiful raspivid displays on my linux desktop.
----
I want to get this same stream to tunnel through ssh when off my local network. (I can SSH into the RASPI from outside the network)
Piping raspivid's output to mplayer and relying on X forwarding works, but that uses too much bandwidth.

I want to tunnel the h264 through ssh.
Can anyone help with the proper ssh -L's or -D's to make this work?

Thanks in advance!

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

Re: ssh-netcat(nc)-mplayer

Wed May 29, 2013 6:16 am

If that's all you want, you don't need to use any special parameters. Just do this:

Code: Select all

ssh [email protected] "raspivid -fps 10 -w 640 -h 360 -vf -hf -t 999999 -o -" | mplayer -fps 11 -cache 1024 -
On the raspivid command you may need to add the parameter for adjusting the bitrate to use something suitable for the speed of your connection.

Besides the bandwidth used, there will also be extra load on the CPU because of the encryption on the ssh connection. I haven't tested the throughput of transfers through ssh on the raspberry pi yet, so I'm not sure how much it is capable of.

Pedulla
Posts: 5
Joined: Tue Jan 29, 2013 6:27 pm

Re: ssh-netcat(nc)-mplayer

Wed May 29, 2013 6:38 am

Oy veh...

Over thinking the problem.

Thanks, that it!

maxtax
Posts: 15
Joined: Wed Apr 20, 2016 11:14 am

Re: ssh-netcat(nc)-mplayer

Sat Oct 15, 2016 4:55 pm

erikcf wrote:If that's all you want, you don't need to use any special parameters. Just do this:

Code: Select all

ssh [email protected] "raspivid -fps 10 -w 640 -h 360 -vf -hf -t 999999 -o -" | mplayer -fps 11 -cache 1024 -
On the raspivid command you may need to add the parameter for adjusting the bitrate to use something suitable for the speed of your connection.

Besides the bandwidth used, there will also be extra load on the CPU because of the encryption on the ssh connection. I haven't tested the throughput of transfers through ssh on the raspberry pi yet, so I'm not sure how much it is capable of.
I know this is old post, but it recently saved me many many hours therefore I want to add a few advices for anyone who might find this useful:

1- mplayer waits for the cache to filled before showing the stream, therefore the higher the reaspivid bitrate (high fps / resolution) the faster the stream starts

2- samewise the mplayer cache parameter, the smaller the faster it fills

3- if mplayer has a higher fps parameter than raspivid any initial lag is caught up as quickly as larger the gap between frame rates. On the other hand, same frame rate will lead to constant lag and slower FR on mplayer will progressively increase the lag

I use it with the following parameters (over wired LAN):

Code: Select all

ssh [email protected] "raspivid -fps 30 -w 800 -h 600 -vf -hf -t 999999 -o -" | mplayer -fps 80 -cache 512 -
and it works like a charm, the stream starts immediately with no measurable lag. May need to adjust the parameters if the transmission is over WiFi.

Return to “Camera board”