View Single Post
Old 16th April 2009, 01:26   #1  |  Link
felinis
Registered User
 
Join Date: Jan 2009
Posts: 2
Recording clear or encoded Streaming Video

It is well known that anyone can record TV programming to a PC by using a video capture card to create a digital video stream that can be captured on a PC. I have been doing this for years using such capture software as Snapstream Beyond TV, VideoDub and of course VLC. The last two are open source (free) software. My favorite DVD burning software is currently DVD Flick, since it can burn DVD-compatable MPEG-2 files directly to DVD without a lengthy encoding process.

But recently I have been downloading a lot of streaming video - YouTube, instant movies, streaming TV programs, etc. Occasionally I would like to record these too, so I started to do some research.

Capturing YouTube is simple - just extract the download URL from the current YouTube web-page and use it to download the video that you have selected. Everyone is doing it and there are dozens of software tools and techniques for doing this. Visit my own YouTube channel at:

http://www.youtube.com/user/MrAlaskaVideo

Just don't download my videos :-).

In 2007 there was a furior over someone having broken the DRM encoding on Netflix "Instant view" streaming movie downloads. With the Netflix viewing system of that time, it was possible to download the entire movie to a large WMV file using a free hacking tool called NetFlixBrowser.

The hitch is that this file is encoded/protected with DRM and is unviewable without online authorization from Netflix. So the hackers would then apply a series of free tools such as UnDRM and FairUse4WM to remove the DRM, allowing the file to be copied, viewed or burnt to DVD.

The new Silverlight-based Netflix viewer now prevents the capture of the entire Netflix stream by repeatedly opening and closing the stream, putting an end to that exploit. Silverlight has its own DRM system too.

Stream capture of video sources can of course be accomplished with VLC, if you can detect the stream and determine its URL. The commercial product WM Recorder does this automatically.

One can also attempt to find the temporary hard disk location where the video stream is being buffered and copy it from there.

There are also a number of commercial "Screencasting" tools, originally intended to be used in education to capture on-screen lectures and tutorials. Since they all have an audio capture feature, these can be configured to capture full-motion video from the computer's screen as well. The most popular ones are WM Capture, Camtassia and Daniusoft.

My research brought me to the following conclusions:

1. DRM hacking is illegal, too much work and is becoming less and less feasable.

2. Trapping incoming streams is becoming harder and harder as content providers change delivery systems.

3. Finding video buffer file locations is problematical.

4. Off-the-shelf products like WM Capture and Camtassia produce jerky full-motion video captures with funky colors.

So I set out to develop my own video stream capture techniques, with DVD Flick-compatible MPEG-2 format as the end target - techniques to record video un-hindered by DRM or copy-protection schemes.

Your internet connection must be capable of streaming high-speed video. You must start out with decent source video that does not jerk or pause.

My first attempt was to fall back on my old stand-by USB video capture tuner. All good video tuner cards have on-board MPEG encoders, so you are streaming MPEG-encoded video/audio into your compuer from the get-go.

I plugged the S-video port of my HP laptop into the tuner to capture the laptop's screen video. I routed the headphone jack into the capture box's "Audio In" port to capture computer audio. This worked very well and I was able to capture any streaming video that I could display on my screen, using Beyond TV for timed recording or VLC for attended sessions. Any capture software that accepts DirectShow input devices works. Those with MPEG-2 output are preferred.

My second attempt allowed me to get rid of the video tuner hardware loop-back. I discovered the free DirectShow screen capture codec called UScreenCapture from Unreal Streaming Technologies. UScreenCapture allows me to capture all or part of the screen at up to 30 frames per second. This works great with VLC or VideoDub.

Play your source video stream in a player - windowed, not full-screen.

Codec Configuration

Set the screen capture boundries on the capture device to 640x480 (856x480 for widescreen 16:9). This is a valid DVD format and will make the frames a lot easier to encode to DVD.

Your capture software can record using any video codec that you want, but MPEG-2 can be recorded to DVD without lengthy recoding.

MPEG Confiiguration

For select single-pass, constant bit-rate video compression.
A bitrate of 4000 kbps will record two hours of video and just fill up one single density DVD.

I found that an I-frame setting of one per second, complex motion setting and a high bitrate help to prevent jerkiness in the streamed video.

Audio Configuration

Set your default "Playback" sound device to Speaker (not S/PDIF) and the default "Record" device to Audio Mixer. If no mixer device appears as a recording selection, right-click on the "Recording" dialog and enable the display of "Disabled Devices".

The type of audio codec doesn't matter much as long as your DVD burner has a matching decoder. Select a good DVD-quality sound format i.e. 48KHz, 192kbps, 16-bit stereo and your DVD burner may not have recode the audio at all.

Frame Rate
24-to-30 FPS.

All of my DirectShow-based capture tools accept this codec except for Beyond TV. Unfortunate, since VLC does not have a working timed recording feature (except for the un-fathomable VLM). It is very convienient to be able to set your capture software to record over-night and terminate when the source video is over.

VideoDub does have a timed recording feature and works very well with UScreenCapture. Select VideoDub's "File/Capture AVI..." feature. Select UScreenCapture as the capture device. Under the "Video/Capture filter..." selection set up the video codec as described above. Select "Video/Compression..." to select and configure a video codec as specified above. Select "Audio/Enable audio capture". Under "Audio/Compression..." select AC3, PCM, DTS or MP2 codecs, all of which are DVD compatable. Select audio bitrate, etc. as described above. Under "Capture/Settings..." set the frame rate as described above.

If you want timed recording, set the recording time, etc. under "Capture/Timing...". Select Capture/Capture video" or press F5 when you are ready to capture (Esc to stop).

Perform several test captures in order to confirm audio capture and to allow you to center the source video into the exact center of the capture window. If you turn on VideoDub's video preview window ("Video/Overlay"), then VD will show you exactly where this capture window is, and allow you to jockey the source video window around to match.

Playback your test recordings with another player like WMP or VLC.

Here is the command line for VLC if you want to try it:

dshow:// :dshow-vdev="UScreenCapture" :dshow-adev="WaveOut Mix (Conexant High Defi" :dshow-size=""
:dshow-caching=200 :dshow-chroma="" :dshow-fps=0.000000 :dshow-config :no-dshow-tuner :dshow-tuner-channel=0
:dshow-tuner-country=0 :dshow-tuner-input=0 :dshow-video-input=-1 :dshow-audio-input=-1 :dshow-video-output=-1
:dshow-audio-output=-1
:sout=#transcode{vcodec=mp2v,vb=2048:sout=#transcode{vcodec=mp2v,vb=1024,scale=1,acodec=a52,ab=192,channels=2}
,scale=1,acodec=a52,ab=192,channels=2}

On my third attempt at screen capture technology, I tried using UScreenCapture with Windows Media Encoder. It wasn't a strong choice, since my target video format is MPEG-2. WME produces WMV, which takes DVD Flick fifteen times as long to encode. If you do not find this to your liking, use the VLC solution above, but do read the recording tips below also.

But guess what? WME has its OWN screen capture device! This codec is just as good as UScreenCapture. One can capture/record ANY video from the screen using WME, protected or not! And one is not limited to recording sound only when with the PC's internal speaker as the default sound playback device. WME will record audio from any of the audio devices, including S/PDIF.

WME starts with a wizard page that has a screen catpure selection. This is a good place to start. Select the option that projects a flashing capture box on-screen. Select a DVD-compliant constant-rate audio format like 48 kHz 16-bit, PCM, AC-3, or MP2.

Adjust the output video compression to constant-rate single-pass MPEG. Increase both the frame and bit rates to make them more appropriate for full-motion video - 24 FPS and 2400 Kbps. 2400 Kbps may be way too fast, but I think in terms of MPEG-2, not WMV. 24 fps looks a little jerky to me, so kick it up to 29.97 if you can afford the extra resources.

Start your video streaming source (whatever!) windowed. Adjust it so that the picture is playing on-screen, within the flashing boundries. Verify your audio (read above). This may take several tries.

None of this work is suitable for slow or single processor computers. Remember, you are performing two computationally and disk intensive operations - streaming the video download, captuing the screen and compressing it all at the same time. My Dell Inspiron 1.73 GHz single M processor laptop chokes trying to do things like this, but my set-top 1.73 GHz dual-processor HP Pavillion laptop does just fine. If your computer bogs down with the processing load, reduce the screen capture area to 360x240.

That is it boys and girls - capture your streaming video to MPEG-2 or WMV, then burn it to DVD.
felinis is offline   Reply With Quote