Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two computers, a desktop in my office ( with a webcam attached ) and a laptop somewhere else on the network.

Usually I take a look at my office through my webcam by running

ssh Office -Y "mplayer tv://device=/dev/video0"

from my laptop. I don't like Xforwarding mplayer, so why can't I tunnel /dev/video to my pc by running this on my laptop?

sudo mkfifo /dev/video1
ssh Office 'dd if=/dev/video' | sudo dd of=/dev/video1'

and then to watch the webcam ( on my laptop )

mplayer tv://device=/dev/video1
share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

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:

  1. Try without named pipe
  2. Check bandwidth

Also - how does in not work (display black screen, complains about unknown device etc.)?

share|improve this answer
    
I think something is wrong with my mplayer. If I run dd if=/dev/video0 | mplayer tv://device=/dev/stdin it tells me the resource is busy. Otherwise it works ( I see video ) even when I run mplayer tv://device=/dev/null –  NixNinja Sep 22 '10 at 8:09
add comment

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.

share|improve this answer
add comment

If you have a low bandwidth I recommend compression of the video stream:

ssh USER@REMOTEHOST ffmpeg -an -f video4linux2 -s 640x480 -i /dev/video0 -r 10 -b:v 500k -f matroska - | mplayer - -idle -demuxer matroska

where

  • -an turns of 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, … See arecord -l for your device). If you want audio only 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.

share|improve this answer
add comment

I don't know if there's any reason you can't do it, but one problem I see with your implementation is that the remote system will look for /dev/video1 on its system, but won't be able to find it because you created it on your local system.

What I'd do is something along the following

nc -l 12345 | sudo tee /dev/video > /dev/null &
ssh Office

and then try something by telling it to go to your local system's TCP port 12345.

share|improve this answer
    
I tried clarifying my question. please see the updated version –  NixNinja Sep 21 '10 at 13:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.