Webcam over network?

8,128

VLC example (for linux):

cvlc -vvv v4l2:// --sout '#transcode{vcodec=mjpg,vb=2000,width=320,height=240,venc=ffmpeg}:duplicate{dst=standard{access=http,mux=mpjpeg,dst=0.0.0.0:5050/video.mpjpeg}'

Then point your non-IE browser to http://127.0.0.1:5050/video.mpjpeg

You can use vlc to stream things other than mjpeg. If computer is slow you need to experiment with codec parameters. You can also use gstreamer (on linux).


ffmpeg example (for linux):

ffmpeg -f video4linux2  -i /dev/video0  -vcodec libx264 -vpre ultrafast -b 1000k -f matroska -y /dev/stdout | nc -lp 5555

playing:

nc 127.0.0.1 5555 | mplayer -cache 1024 -

Highly tweakable.

The same, but with socat and HTTP:

socat tcp-l:5555,fork,reuseaddr system:'printf "HTTP/1.0\\\\x20200\\\\x20OK\\\\r\\\\n\\\\r\\\\n" && ffmpeg -f video4linux2  -i /dev/video0  -vcodec libx264 -vpre ultrafast -b 1000k -f matroska pipe\:1'
mplayer  http://127.0.0.1:5555/

More advanced version with sound here.

Share:
8,128

Related videos on Youtube

Roger
Author by

Roger

Updated on September 18, 2022

Comments

  • Roger
    Roger almost 2 years

    I'm looking to place a usb webcam in a remote room. The only nearby computer is a not so powerful HTPC. How might I access that webcam remotely from my main pc?

    The HTPC is hooked up to a projector so anything that has to be setup/started would be done using remote desktop. Ideally it would not be cpu/mem intensive, I'm hoping for just some passthru usb-to-network setup.

    I've tried using VLC however starting the stream using remote desktop doesn't seem to work and the transcoding takes about 30% cpu. Any suggestions?

    • Christoph Rüegg
      Christoph Rüegg almost 13 years
      Do you have an OS?
  • slhck
    slhck almost 13 years
    Please only post one answer to a question. You can always go back and edit your previous one too.
  • Vi.
    Vi. almost 13 years
    @slhck, Discussing this on meta.