Well, I decided to take it up a notch. Now I can get a real-time video feed of whatever my EeePC's webcam sees!
Here's what you'll need to do the same thing on your machine:
- Linux lap/desktop with: 1) a webcam, 2) an SSH server, 3) VLC media player, 4) a public IP address (if you want to view the feed from outside your local network)
- Another lap/desktop with: 1) an SSH client, 2) VLC media player
For the purposes of this demo, we'll use two computers [EeePC] and [Other]. [EeePC] is the computer running Linux (Ubuntu 8.04 in my case) with the webcam that I want to watch and [Other] is some other computer (OS not critical).
- Connect to [EeePC] using SSH. If you're using PuTTY, make sure to set "Connection > SSH > Tunnels" to:
Source port = 9091
If you're using the command line it looks like this:
Destination = localhost:9091
'Local' and 'Auto' selectedssh user@[EeePC] -L 9091:localhost:9091
... isn't that much easier? - Once you've connected to your [EeePC], run the following command:
vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-adev=/dev/dsp :v4l2-standard=0 :sout="#transcode{vcodec=mp4v,vb=800,scale=1,acodec=mpga,ab=128, channels=2}:duplicate{dst=std{access=http,mux=ts,dst=localhost:9091}}"It's a beast, I konw, just copy/paste it into the terminal window of your [EeePC], or better yet, put it in a script on your [EeePC]! - You'll see a lot of text scroll across your screen. When it stops, you'll want to open up your local copy of VLC player
- In VLC go to:
Media > Open Network > Protocol = HTTP > Address = localhost:9091
and again, if you're using the command linevlc http://localhost:9091
starting to understand why geeks like the command line? - What happens next should look something like this:


9 comments:
Great post! I'm using this on a Toshiba laptop with external webcam, and it works great. I was wondering, as I'm a noob, if you could tell me what part of the command line to omit to NOT pull the audio?
Hi Lamp, sorry it's taken me so long to respond - I've been on vacation with my family all the last week.
To run this without the audio, use the following command line:
vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-adev=/dev/dsp :v4l2-standard=0 :sout="#transcode{vcodec=mp4v,vb=800,scale=1}:duplicate{dst=std{access=http,mux=ts,dst=localhost:9091}}"
Ben,
Im trying to do something similar for my senior project using the OLPC and streaming the video to a local website. I have been having issues with this process. The code you use to launch the server i get accept the "v412:" What is this for and i was curious if you could advise my on getting mine to work. Thanks.
Hi Dave,
Instead of "v412", try "v4l2" (lowercase "L" instead of a number "1"). It's an abbreviation for "video for Linux two".
-Ben
Ben..
Thanks i got it to work, however it has a 10 second delay between the video and receiving. Is there anyway i can speed this lag up? The camera im using is rated for 30 fps... Any suggestions. BTW thanks this command line got me farther then 3 months of looking
Hi again Dave,
Awesome, I'm glad that it's working for you! You can try to improve the performance with a couple small changes:
1 - Add the "-c" flag to the ssh command. This will compress the ssh tunnel and may produce better frame rate.
2 - Reduce the resolution & bitrate of the capture. You can do this by experimenting with reduced "vb=" and "scale=" options in the VLC command. For example, if you changed "vb=800" (which is VLC's devault) to "vb=512" and "scale=1" to "scale=0.5" you would see a smaller picture, but it would also transmit more quickly and smoothly.
Beyond those tips, there isn't much else you can do other than getting a connection w/ more bandwidth and/or less latency.
-Ben
it went from 10 to 4 seconds... with the scale and VB... where is the -c flag set im assuming in the {access ***** } area or am i wrong..
Thanks so much for a quick reply :)
If you're using PuTTY, you can enable compression by following this click-trail from the main config window:
Connection > SSH > Check "Enable compression"
If you're using the command line to start your SSH connection, you just need to add "-c" to the command line like this:
Before:
ssh user@[EeePC] -L 9091:localhost:9091
After:
ssh user@[EeePC] -c -L 9091:localhost:9091
Oh, i forgot you were using putty. I'm trying to stream it through HTTP, so that would make sense why i didnt catch the flag..
Thanks for all the help man, my senior project is near completion because of that. Now i just got to figure out the embedding part and im set.
Thanks again for all the help
Post a Comment