Friday, February 22, 2008

How to Stream your Desktop using VLC

Found out about this just a few days ago, pricesless. I know you can use RealVNC for things like this and its also interactive, but this is also a great option specially if you don't want to give any one access to your PC, and only want them to be able to see what you are doing.

This should work with all platforms i.e. Windows/Linux/Mac as long as the version of VLC installed is 0.8.6 or newer.

To stream your Desktop to a remote machine do the following:

First install VLC on the source (desktop you want to stream) as well as the machine that you want to watch the desktop on.

Then from command prompt (sorry as far as I know this is command prompt only) go to the directory where VLC is installed and run the following command (change the IP address to the machine you want to stream too)

vlc screen:// :screen-fps=30 :screen-caching=100 --sout '#transcode{vcodec=mp4v,vb=4096,acodec=mpga,ab=256,scale=1,width=1280,height=800}:rtp{dst=192.168.1.2,port=1234,access=udp,mux=ts}'

where:

* screen:// is our input module selection
* :screen-fps=30 specifies that we want to screengrab at 30 fps (from default 5 fps)
* :screen-caching=100 sets the internal caching to 100ms (from default 300 ms)
* --sout is our output chain.
* #transcode tells vlc that we first want to transcode the input using parameters to follow
* {} contains our transcoding parameters
* vcodec=mp4v sets the video codec to mpeg4 video
* vb=4096 sets the bitrate of the transcoded video (4Mb/s)
* acodec=mpga sets the audio codec to mpeg audio (mp3). Audio does not work yet, this is a place holder.
* ab=256 sets the bitrate of the transcoded audio (256 Kb/s)
* scale=1 sets the scaling value
* width=1280 sets the width of the transcoded video to 1280 pixels
* height=800 sets the height of the transcoded video to 800 pixels
* :rtp tells VLC that we want to use rtp protocol to send the encoder output to our receiver machine using Real Time Protocol.
* dst=192.168.1.2 is the ip address of our destination/playback machine
* port=1234 is the default port on the destination/playback machine
* access=udp specifies UDP protocol
* mux=ts sets multiplexing to mpeg-2 Transport stream

You can always change the settings as per your requirement.

On the Destination machine do the following:

open VLC,
Goto File/Open Network Stream and by default the Media Resource Locator on top of the window should read udp:// and UDP/RTP with port 1234 should be selected. If it's not select UDP/RTP (option 1) and put 1234 as the port number. Press Okay and you should see the video stream from the other machine (your server machine).

And that should be it, as easy as that.

If you want to play around a bit try 'vlc screen://' at command prompt. This should open your desktop within you session of VLC :)

Have fun!

13 comments:

Anonymous said...

any idea how to do that but save it as a file?

Anonymous said...

Thanks a bunch!

ticz said...

i cant do it... why oh why...

Aurimas N. said...

can I stream it to http so multiple users can watch it outside my LAN?

Anonymous said...

works great for my primary monitor but
how would i go about streaming my second screen or even only a part of it without installing extra software?

smoorke said...

--screen-top=<integer>
--screen-left=<integer>
--screen-width=<integer>
--screen-height=<integer>

Paul said...

Does this still work for OS X Lion?

OkoWsc said...

for reference purposes,you can do this in the GUI vlc,
go to media-stream and follow instructions

Staffing Agency Atlanta said...

This was an extremely good post. Spending some time and actual effort to generate a great article.

steward said...

Thanks for sharing this helpful article,.
3D Molding

best computers said...


Hi, I am John working in IT company. Cause of busy I work in my home so, I need a high-configaration which is one of the
best computers.best computers.
So, I was feeling worried about the best computer. By friend suggest me to visit your website and got it. This is really good product.
Specially RAM, graphic, and all configaration are good. I am happy. I am happy.

Matt said...

Any idea how you would stream your external monitor instead of your main screen?

Don said...
This comment has been removed by the author.