User Tools

Site Tools


talk:stream_pc

Comments by hiviking, 2012-01-13:

I tried the setup described in the article and it worked, but I got jerky video. My computer is a Lenovo R61 which has a Core2Duo T8100 2.1 GHz CPU, running Windows XP SP3. My mediplayer is an Ellion HMR-600. For a long time I have been using VHScrCap to capture Google Earth animations in VirtualDub, and it has been able to capture at 848×480 pixels and 30 fps without missing a frame. So, I gave it a try in VLC. It worked fine in Play mode, but when I tried to stream it, I got a blank screen and lots of errors in the log.

I, therefore, returned to the Screen Capture Recorder and experimented with the settings. In the end I managed to get a very good result, which played smoothly. I tested this on a YouTube video and compared the desktop stream with a direct stream from YouTube. The desktop stream was in fact much better quality.

Since I spent some time on getting this result I think it is worthwhile to share it. The Lenovo R61 has no Wave input that you can record from, so I used the Virtual Audio Cable. You may be able to use the Wave input from your soundcard as the audio capture device in step 3a.

To get a sharp image of the screen that plays smoothly I found that I had to limit the capture area to about 640 x 360 pixels. I also found that the area must have an aspect ratio of exactly 16:9, otherwise the output will be garbled. So, you initially setup a 640 x 360 area at max 25 fps in the Screen Capture Recorder using “configure by setting specific screen capture numbers” in the start menu. In the future you just use “configure screen capture by resizing a transparent window”, but you don't resize it, just move it to the right place on the screen. You have to make the video appear at a size close to 640 x 360 pixels, which can be done by using the zoom feature in your browser.

To set up VLC streaming the following steps are needed. You can use the VLC command line listed below, but using the GUI allows you to make changes according to your preferences.

1. Direct all audio output to Virtual Cable 1 in Control Panel/Sounds and Audio Devices.

 Or setup recording from the Wave input if your computer allows it, and select your sound card as the audio device.

2. Resize the video you wish to stream to a size close to 640 x 360 pixels on the desktop (see Tip below).

 Place the Screen Capture Recorder window over the video as explained above.

3. Open VLC and select Media>Streaming.

 a. Select Capture device and then Select screen-capture-recorder and Virtual Cable 1 (or your sound card).
 b. Click Advanced options... and set the aspect ratio to 16:9.
 c. Check Show more options and increase caching to 2000 ms.
    The first part of the command line options can be seen below.
 d. Click Stream which gets you to the Source window where you click Next.
 e. In the Destinations window you select HTTP, click Add and write go.ts after the / like this: /go.ts.
    (it may work for you with go.mp4, but my mediaplayer won't accept it, only go.ts).
 f. Activate Transcoding should be checked and you select H.264 + AAC (MP4), which should be the default choice.
 g. Click the Edit Selected Profile button and for Encapsulation choose MPEG-TS.
    This corresponds to the ts extention; if you choose .mp4 you should use the MP4/MOV encapsulation.
 h. Click the Video codec tab and set: H-264, 600 kbps, and 25 fps. Scale 1, width 0, height 0.
 i. Click the Audio codec tab and set: MPEG 4 Audio (AAC), 96 kbps, 2, and 44100.
 j. Click Save to save the profile. You can now skip steps g-j in the future.
 k. Click Next to get to Options. If your path to the mediaplayer goes through several routers you should increase TTL.
 l. Click Stream and you should see "Streaming" appear at the bottom of the VLC window.
    The second part of the command line options are listed.
 If you want to see the streamed video in the VLC window, you can check "Display locally" before step e.
 This will probably take some extra processing, so you should normally skip it.

4. In the ServioConsole you add this Online Source as a Live Stream: http://@localhost:8080/go.ts, with a Display Name of e.g. Desktop Stream.

Using the command line options from steps 3c and 3l it should be possible to create a batch file, so that you can start VLC and your stream with a few clicks in the future. The exact layout of the command line is very critical. By combining the format from the article with the options from 3c and 3l I finally managed to get a working command line:

"F:\Programs\VLC\vlc.exe" -vvv dshow:// --dshow-vdev=screen-capture-recorder --dshow-adev="Virtual Cable 1" --dshow-aspect-ratio=16\:9 --dshow-fps=0 --dshow-caching=2000 --sout=#transcode{vcodec=h264,vb=1000,fps=25,scale=1,acodec=mp4a,ab=96,channels=2,samplerate=44100}:std{access=http,mux=ts,dst=:8080/go.ts} --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep

I have increased the bitrate of the video to 1000 as it does not seem to affect my CPU load appreciably. You may increase it more if you like, but 1000 kbps H264 actually provides a better quality than 10000 kbps MPEG2. The CPU load difference on my computer is 90-95% versus 60-65%, so if your CPU is too slow or you need the extra capacity you should use MPEG2. In my case the key to avoiding jerky video was to reduce the size of the streamed desktop area.

Tip: If you are using Google Chrome the zoom step is very large and cannot be changed. There is, however, a very convenient extension called zoomWheel, that will let you zoom with your mousewheel in steps down to 1%. You can add it to Google Chrome with one click at http://www.chromeextensions.org/appearance-functioning/zoomwheel/. With this extension you can always make your video appear with the size you want.

———————————— Change log ————————————–

2012-01-14: Updated the command line and final comment.
2012-01-18: Added comment about Google Chrome zooming.

talk/stream_pc.txt · Last modified: 2012/01/18 15:12 by hiviking