how to use VLC to stream your desktop live (windows) with audio (or stream a DVD)

Turns out that you can…I think so anyway.

Basically you setup VLC to stream from your desktop+audio.

Sound easy? It does take a few steps to get setup.  I should make it easy and market it :)

To stream desktop (skip below for DVD):

VLC by default comes with a “screen input” option, to capture the desktop.  Unfortunately it appears there’s a bug and currently it cannot use that option to capture along with audio (it is video only).

So we will have to use an alternative input, called DirectShow.  With Directshow, you can choose your video and your audio input device separately, and they do work together out of the box.

So first go and download a direct show screen capture input filter: http://betterlogic.com/roger/?p=3059

Next setup your sound card to be able to “capture” wave out.  If it is not there as an option then you may find some helpful notes here: http://betterlogic.com/roger/?p=3073

Now open VLC, choose Media [menu] -> Streaming -> Capture Device tab -> Set video device name as “screen capture” (may need to hit “refresh list” button first), and set audio device name as whatever device is capturing your wave out (probably your default sound card name, maybe something else).

Now to click on “stream” at the bottom.

To stream a DVD:

Go to Media [menu] -> Streaming -> Disc (make sure right drive is listed), hit Stream. (You may want to click “No DVD menus” and/or select a specific title.

Now for both:

Click on “Destinations”, change destination to http, click add, change url to “/go.mpg”

Now you’ll want to stream it using mp3 audio output, so click the wrench to edit the output options -> audio codec tab -> change it to mp3, hit save. (to be specific, you’ll be using the predefined “Video – H.264 + AAC (MP4)” setting, but with its audio changed to “mp3″). Note also that this eats up a fair amount of CPU since it is transcoding to H.264

Now hit “Stream”

It should now say “streaming” on the bottom.

Now to test your stream, let’s watch the stream by viewing it within another VLC instance (as client this time).

open up another instance of VLC, and open up that very stream, like

Media [menu] -> Open Network Stream -> type in http://localhost:8080/go.mpg

If this works, you are half way there.

Now let’s discover our more public IP address:

First find out your IP by running the “ipconfig” program.  Open the “run” box by hitting windows + r key, now type in “cmd /c ipconfig && pause”

Looks for a line like “IP Address …… 1.2.3.4″ (your IP address if the 1.2.3.4). (in vista it will say IPv4 Address).

now open it with a new instance of VLC, like

Media [menu] -> Open Network Stream -> type in http://1.2.3.4:8080/go.mpg (replace 1.2.3.4 with your IP Address).

And you’re live.  At least you could theoretically go to other computers on your local network and they can see that stream of your  “screen share” your desktop and audio now.

If you wanted to watch it live from “anywhere on the internet” you’d probably have to setup appropriate port forwarding, which is a topic for another day.

Comments welcome.

Also note that if you just need “point to point” streaming, you can also use ffmpeg for the streaming, which tends to be faster and more reliable in my experience, though doesn’t have a nice GUI to help you :)

http://trac.ffmpeg.org/wiki/StreamingGuide

50 thoughts on “how to use VLC to stream your desktop live (windows) with audio (or stream a DVD)

  1. Pingback: How to use VLC as a free open source alternative to playon.tv « Roger's woze

  2. Pingback: vlc cannot see stream of desktop « Roger's woze

  3. Pingback: how to stream from pc to tv using vlc « Roger's woze

  4. if yours skips, here are some ideas to make it faster:

    change screen resolution (size, bits)
    change fps (of both encoder, the input)
    write your own speedier screen capturer (directshow filter et al): http://betterlogic.com/roger/?p=3037
    change what you “encode” it into
    get a faster cpu/more cores
    possibly getting a quality GPU/graphics card (might help) and/or enable it in VLC so that it can use it.

    use ffdshow or another encoder? http://forum.videolan.org/viewtopic.php?f=14&t=81373

  5. even more aggressive would be: save it “raw” to a file, let it buffer for awhile, writing that file, then stream from that file, or transcode from that file to an “encoded” file, then stream from the encoded file. triple buffer!

  6. I can’t get this to work. Using VLC 1.1.4 is crashing when trying to use the MediaLooks Screen Capture.

  7. hi, i am trying to use your directshow filter to multicast my desktop with audio using vlc. how ever, the pc i am using is XP sp3 and it installs fine but when i launch the configure script it flashes briefly on screen then disappears. worked fine on my vmware XP on my macbook but not on an actual HP pc running XP. any ideas?

    F

  8. Using your audio sniffergrabber, but the audio starts to skip after 5 seconds, any ideas?

  9. I’m on windows 7, using VLC 1.1.11, I’m selecting 12 fps, with H.264+AAC(MP4) profile. I have selected DirectShow as the capture mode, with the video device being screen-cpature-recorder. The audio device is my default recording device, and I have installed your audio snigger grabber. When I playback a screen capture, the audio works fine for 5 seconds, then the audio skips and sounds completely garbled. I can send you the recording, it’s only 1.5MB.

  10. @Fred ok could you try the latest version? If it fails could you cd to the right directory and run the batch file that the link points to? thanks.

  11. This is great! I was looking for a simple way to screen cap audio + video to various file formats. This integrated with VLC is simple and does the trick. I’m not an AV buff by any means, just getting my feet wet in this area and even I could figure it out.

    I do have one question. It seems to capture the entire screen by default. Is there a way to capture only a partial screen or window based on starting X/Y coordinates? For example, starting at 10/10, record 800×600. Basically, not starting from the very top left corner, but starting from 10 pixels down and 10 pixels over, record 800 pixels wide by 600 pixels tall. Is this possible and how can it be done? I was thinking this would be done under “configure by setting specific screen capture numbers”, but when I try to execute this I just get a window which flashes open and closes real fast and nothing else happens. I have Java installed but it seems to not be working properly. Any assistance is greatly appreciated.

    Thanks. If this isn’t possible I suppose I can probably crop the video post-capture somehow.

    –Dan

  12. Could you cd to your program files\screen capture recorder\configuration_setup_utility and run the batch files there and see what happens?

  13. C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility>edit_config.bat
    ‘opening configuration utility’
    ‘java’ is not recognized as an internal or external command,operable program or batch file.

  14. I added the folder containing java.exe to my PATH and then tried running the .bat script again and got the following:

    C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility>edit_config.bat
    ‘opening configuration utility’
    “height”
    LoadError: no such file to load — sane
    require at org/jruby/RubyKernel.java:1038
    (root) at ./jruby-swing-helpers/swing_helpers.rb:19
    require at org/jruby/RubyKernel.java:1038
    __for__ at setup_screen_tracker_params.rb:63
    each at org/jruby/RubyArray.java:1603
    do_command_line at setup_screen_tracker_params.rb:53
    (root) at setup_screen_tracker_params.rb:97

  15. I tried to use this screen-recorder with Adobe Flash Media Live Encoder, and AFMLE just says there was an error with the stream.

    We really need an easy to use open-source replacement for that VH Screen Capture Driver which seems destined to disappear when XSplit becomes a real product.

  16. hey, very nice tutorial, this is what i looking for. it works well, but the default quality is horrable. i wanna change the settings, but i have the same problem like dan. java dont start, only a short flash of an window and close immediately. i use win7 64 bit, java 6.31 and your programm v0.4.0, can you help me please? additional info: the benchmark speed test works.

  17. java is not in the default path installed, if you mean this, sry for my bad english. jruby-complete is linked to start with java but it happens nothing.

  18. Pingback: VNC. Why do school techies dislike it?

  19. Hi Roger thanks for the article, I’m not able to play the stream from a local VLC client on my Win7 box, please can you assist at all?

    I followed the steps to create the stream in VLC: selected Capture Mode = DirectShow, Video Device Name = screen-capture-recorder, Audio Device Name = virtual-audio-capturer, streaming to HTTP port 8080 with Path = /go.mpg, changed Audio Codec to MP3 and finally clicked Stream. The VLC traffic cone icon appears with “Streaming” but the log contains errors such as “cannot start HTTP server” and “cannot start stream output instance, aborting”.

    The full log is:
    qt4 debug: MRL passed to the Sout: dshow://
    qt4 debug: Adding option: dshow-vdev=screen-capture-recorder
    qt4 debug: Adding option: dshow-adev=virtual-audio-capturer
    qt4 debug: Adding option: live-caching=300
    qt4 debug: Adding option: :sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{dst=:8080/go.mpg}
    qt4 debug: Adding option: sout-keep
    main debug: adding item `Streaming’ ( dshow:// )
    main debug: meta ok for (null), need to fetch art
    main debug: rebuilding array of current – root Playlist
    main debug: rebuild done – 1 items, index -1
    main debug: processing request item: Streaming, node: null, skip: 0
    main debug: resyncing on Streaming
    main debug: Streaming is at 0
    main debug: starting playback of the new playlist item
    main debug: creating new input thread
    main debug: Creating an input for ‘Streaming’
    main debug: looking for meta fetcher module: 1 candidate
    lua debug: Trying Lua scripts in C:\Users\Dan\AppData\Roaming\vlc\lua\meta\fetcher
    main debug: using sout chain=`transcode{vcodec=h264,vb=0,scale=0,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{dst=:8080/go.mpg}’
    main debug: stream=`http’
    lua debug: Trying Lua scripts in C:\Program Files (x86)\VideoLAN\VLC\lua\meta\fetcher
    main debug: looking for sout stream module: 1 candidate
    lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
    main debug: set config option: sout-standard-dst to :8080/go.mpg
    main debug: looking for sout access module: 1 candidate
    main debug: net: listening to * port 8080
    main debug: using meta fetcher module “lua”
    main debug: TIMER module_need() : 1.511 ms – Total 1.511 ms / 1 intvls (Avg 1.511 ms)
    main debug: removing module “lua”
    main debug: searching art for Streaming
    main debug: looking for art finder module: 2 candidates
    lua debug: Trying Lua scripts in C:\Users\Dan\AppData\Roaming\vlc\lua\meta\art
    lua debug: Trying Lua scripts in C:\Program Files (x86)\VideoLAN\VLC\lua\meta\art
    lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\art0_musicbrainz.luac
    lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\art1_googleimage.luac
    lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\art2_frenchtv.luac
    lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\art3_lastfm.luac
    main debug: no art finder module matching “any” could be loaded
    main debug: TIMER module_need() : 3.032 ms – Total 3.032 ms / 1 intvls (Avg 3.032 ms)
    main debug: art not found for Streaming
    qt4 debug: IM: Setting an input
    main error: signaling pipe error: No error
    access_output_http error: cannot start HTTP server
    main debug: no sout access module matching “http” could be loaded
    main debug: TIMER module_need() : 52.972 ms – Total 52.972 ms / 1 intvls (Avg 52.972 ms)
    stream_out_standard error: no suitable sout access module for `http/ps://:8080/go.mpg’
    main debug: no sout stream module matching “http” could be loaded
    main debug: TIMER module_need() : 53.319 ms – Total 53.319 ms / 1 intvls (Avg 53.319 ms)
    main debug: destroying chain… (name=(null))
    main debug: destroying chain done
    main error: stream chain failed for `transcode{vcodec=h264,vb=0,scale=0,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{dst=:8080/go.mpg}’
    main debug: finished input
    main error: cannot start stream output instance, aborting
    main debug: dead input
    main debug: changing item without a request (current 0/1)
    main debug: nothing to play
    qt4 debug: IM: Deleting the input
    main debug: TIMER input launching for ‘Streaming’ : 82.561 ms – Total 82.561 ms / 1 intvls (Avg 82.561 ms)

    Thanks

  20. Is there a way already setup using your video capture tool so it will capture transparent windows? Or can this be done outside of your tool? thanks so much

  21. hi !
    Thanks for your very nice tutorial it’s perfect :)
    But i have one problem : when i tried to record a game in full screen mode, the game is not recorded (just the other regular windows are recorded)
    Any idea about how to correct that ? :)
    Thanks !

  22. Left 4 dead 2 :)
    I just succeed to screen capture the game with the windowed mode (without bordure) inside the game, but i presume that some other game cannot allow that.
    Thanks for your quick answer :)

  23. To stream “anywhere on the internet” is “a topic for another day”.
    If you writte it, where can i found it ? :)

  24. Just in case you’re still looking at this thread:
    I recently tried to stream using VLC 2.0.5. The UScreen Capture and VHScrCapture are both crashing the player, so I tried using your filter. The stream works fine after configuration, but I’m getting an image that is significantly skewed, so much so that I cannot tell what is being shown on the computer that is watching the stream. Suggestions?

  25. Hi,

    It seems I’m have the same problem as Chris. I’m also trying to stream using VLC 2.0.5.
    UScreenCapture and VHScrCap are both crashing the player…
    So I was very happy to find your filter which actually works fine when I just test without streaming. Once I start streaming with VLC the image is completely distorted. It shortly showing a green screen later some skewed black-gray-purple lines combined with small pieces of what is actually on the screen.
    I think it must have something to do with the transcoding. However I have tried so many hours playing around with the settings and still didn’t get it to work. When I disable the transcoding the stream doesn’t load anymore.

    My system is Windows7 64-bit. I have tried both the 32-bit and 64 bit version of VLC as well as an older version (2.0.0). I’m trying to stream to http.

    Hope you can help us out, it looks promising to stream my screen to my tv in this way!

    Thanks a lot

  26. I have a microsoft screen recorder.but doesn’n record VLC file.what should I do?

  27. I got the streaming to work using your instructions using your directshow plugin. however do you know how I would run the stream from a command line in VLC?

  28. I’m pretty sure your Screen Capturer Recorder filter causes VLC to crash when no audio has been recorded. Also, recording [exclusively] from Unity doesn’t fix this, despite it being recorded successfully when other system sounds are also recorded.

    Repro:
    1. Set up a stream to a file on the disk as per your post (all default settings, mp4 encoding)
    2. Don’t let any sound get recorded
    3. Hit the stop button to finish recording
    4. VLC closes. When you open VLC again it notifies you of the crash and the file is not playable.

    Info:
    Windows 8
    Realtek HD Audio/Doby Home Theater v4
    VLC 2.0.7
    Email me if you need more information, because I won’t check back here.

  29. Pingback: idream's blog » ??VLC?????????????????????

  30. Hey robert,
    lovely instructions. I had some difficulty with the streaming, as it only showed the first few seconds of the video while I was viewing it in another VLC as a client. I followed your exact instructions. I am trying to record a DVD.

  31. Hello,
    The stream works a little, but the sound does not match the screen, because the people’s voices come before their mouth actually moves. How do I fix this? Any help would be great.

  32. Pingback: 18 programas gratis para capturar pantalla en vídeo | Jose Manuel Fuentes Prieto

  33. Pingback: ffmpeg screen capture directshow windows | Roger's woze

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>