Can I pipe /dev/video over ssh
If you have a low bandwidth I recommend compression of the video stream (still works in 2020).
with ffmpeg
and mplayer
ssh USERNAME@REMOTEHOST ffmpeg -an -f video4linux2 -s 640x480 -i /dev/video0 -r 10 -b:v 500k -f matroska - | mplayer - -idle -demuxer matroska
where
-an
turns off audio encoding. If you want audio, replace-an
with-f alsa -ac 1 -i hw:3
(where hw:3 could also be hw:0 or hw:1, … Seearecord -l
for your device). If you want audio only (no video), use this)-s 640x480
is the size of your video in x and y dimension-r 10
is the framerate you want to receive (lower makes better images at low bitrates, but looks more bumby)-b:v 500k
is a bitrate of 500 kilobit/s
You need ffmpeg on the remote host and mplayer on the local machine installed.
with ffmpeg
and mpv
ssh USERNAME@REMOTEHOST ffmpeg -an -f video4linux2 -s 640x480 -i /dev/video0 -r 10 -b:v 500k -f matroska - | mpv --demuxer=mkv /dev/stdin
with ffmpeg
and ffplay
ssh USERNAME@REMOTEHOST ffmpeg -an -f video4linux2 -s 640x480 -i /dev/video0 -r 10 -b:v 500k -f matroska - | ffplay -f matroska /dev/stdin
Something like:
dd if=/dev/video0 | mplayer tv://device=/dev/stdin
works for me (SOA#1) locally. So does:
ssh localhost dd if=/dev/video0 | mplayer tv://device=/dev/stdin
As well as
mkfifo test
dd if=/dev/video0 of=test &
mplayer tv://device=test
Hence:
- Try without named pipe
- Check bandwidth
Also - how does in not work (display black screen, complains about unknown device etc.)?
The VideoLAN Project exists in large part to do just what you desire.
I've not used its streaming capabilities but in its single machine use it has shown to be rock solid for me.