Television-related (and video-DVDs/CDs)

includes various 'HTPC' (HomeTheater-PC) solutions

Although it's explained elsewhere, DOWNLOADING from Google Video is also easy, and typically results in a .WMV [Windows Movie], .MP4, or a .FLV file [which is the 'flash video' format they convert their user-uploads into, resulting in a standard format for their video-servers.] To convert a .MP4 or .WMV to a .AVI (and other formats), I use the Linux 'mencoder' package.

Here is the specific separate writeup I did, as an example:

Dave's Howto on making a 'SVCD' (a CD-media-based video)

You don't need any capture-card for this step, as all video-content is just downloaded. Mostly, I learned the SVCD-specifics from THIS website (also mentioned above): http://en.linuxreviews.org/HOWTO_Make_a_video_(S)VCD

Note: Prerequisite software packages are 'FFmpeg' and 'DVDStyler'. [On Linux, also add 'k3b', 'mencoder', 'transcode', 'vcdimager', and 'xine-ui'. You'll probably need to EXPLICITLY install most of these. Free public-domain versions of the key ones, i.e. 'DVDStyler' and 'FFmpeg', are 'cross-platform', so they exist for WinXP, and probably MAC OS X, etc.] Thus, it's very easy to make videos on WinXP, too...I've done it there, as well as on Linux. [Note: You don't actually need 'DVDStyler' until the next section, when burning true DVDs, using DVD-video format.]

Step 1: Acquire/capture/download a video-file (e.g. a .WMV), such as 'RealTime-Falwell.wmv' (e.g. from Google-Video website).

Step 2: To convert this .WMV to .AVI (and other formats), use the Linux 'mencoder' cmd-line program. [See 'man mencoder' for details and other options.]

[This conversion creates an avi file from a wmv file. Takes about 10 mins for this 6 MB file. This is on my old/slow laptop. Resulting file is 39 MB and contains about 7500 frames.] [Note: Using audio option "-oac pcm" balloons the filesize, but audio-quality remains GOOD! Using the audio option "-oac copy" results in a much smaller, but audio-damaged output file.]

mencoder RealTime-Falwell.wmv -ofps 23.976 -ovc lavc -oac pcm -o RealTime-Falwell.avi

Step 3: Convert the .AVI file into the actual 'svcd-compatible' (still on your hard-drive) with a 'ffmpeg' command like:

ffmpeg -i RealTime-Falwell.avi -target ntsc-svcd RealTime-Falwell.mpg
[This conversion takes about 14 minutes on that laptop for 7500 frames, input is 39 MB, output size drops back down to 35 MB.]
[Note: Here in the USA, we use 'NTSC', but in Europe (and elsewhere?) they use 'PAL', so you'd want to adjust your 'target' name accordingly...see 'man ffmpeg' for details.]

Step 4: Burn that onto actual CD-media itself...I use Linux's K3B as follows: Within K3B, choose 'New Video CD project'...its next screen prompts you to just drag/drop your video file(s) into K3B's bottom-portion of the window, and then hit 'burn' button. It works for me...I've done a couple different variants, for creating the video input. Once real simple scenario was that I captured a portion (e.g. 30 minutes) of a movie from my cable set-top box, telling my capture software to put the output into a 'SVCD-format'. This resulted in a single .mpg file, which I burned, and then tested it, by inserting the resulting CD into a normal (Pioneer) DVD-player that's coupled to my home TV. It plays fine...of course, there are no separate screen titles, and the close-caption info that WAS PRESENT in the input, did NOT come thru. [More on this later.]


Ok. For the next project, I decided to burn DVD-media, from a larger, full-length movie that I'd captured. This came from my set-top cable-box. To do the capture, I selected an output recording format designated as 'DVD - 2.0 MB/sec', which resulted in a .mpg file about 2.1 GB in size, from just over 2 hours of recording time. This capturing I do under WinXP, using the provided 'WinTV2000' program that came bundled with the hardware.

To pre-process the captured file, I again use an 'ffmpeg' cmd like:

ffmpeg -i SomeMovie-captured.mpg -target ntsc-dvd SomeMovie-result.mpg

To build the .ISO file, I reference the 'SomeMovie-result.mpg' file, from 'DVDStyler'. This is one of the most popular 'DVD-authoring' programs. Then, I burn the resulting .ISO. Rather than describe all the details of that here, just read my writeup that I placed into the template-article I found on the Linux Review site, at:

This works elegantly. [One important remaining issue is to figure out how to get 'captioning/sub-titles' to come thru and work on the resulting DVD.

From time to time, you'll need to snip off extra stuff at the end (e.g. if you let your capture software run past the end of a broadcasted movie) or if you need to edit out commercials, or whatever. To do this, you'll need a 'video editor'. There are a few to choose from...on Linux, I've tried 'Avidemux' and 'Kdenlive', and heard about a new, simpler chop-out-editor named 'GOPchop'. Your Linux distro should have all these available in its software repository.

Lately, for the simplest editing, I've come to prefer 'avidemux' as it allows you to 'index', and thus cross-reference frame#s with time-values for one's current-position. Because I've wanted to post-processing the raw-captured video, using the cmd-line tool 'FFmpeg', I then specify the '-target dvd' arg, and the '-vframes' arg to 'FFmpeg', stating where to stop the converter.
'Kdenlive' has both a support-forum website, and a separate tutorial website:

I haven't yet tried the promising 'GOPchop', which is a simpler video editor recommended for chopping out commercials, etc. It claims to use a sophisticated editing technique, which chops only on 'i-frame' and/or 'GOP' boundaries, allowing it to edit without the need for re-encoding.


Future video-project: Construct your OWN music-video:
e.g. Take some cuts of the movie 'The Pallbearer' (Schwimmer/Paltrow), while playing an MP3-tune of some 'love song'.
Future advanced video-project: Learn to pull apart a commercial, 'content-protected' Movie-DVD.
This is legitimate. Consider, for example, people who are trying to move a movie that they purchased the DVD of, onto their iPod or iPhone. [There seem to be lots of folks learning how to do this sort of hacking, based on Internet chatter.]

A major issue seems to be whether you'll want to buy a TV-tuner card for your PC (to capture analog or digital streams, or whether you could just hookup the PC to the TV 'set-top' box (and capture those analog or digital streams from it). According to the Wikipedia info, they seem to be saying that, for a set-top box, you want it to have a firewire output connector ('firewire' is also known as IEEE-1394). I now HAVE access to a DVR-box (i.e. a Comcast-provided Motorola box...DCH3416, with a firewire-port) and all info on the Internet claims that the '5C-bit' will be set on all but local-station broadcasts [tho this may vary regionally]. Thus, the only solution when the 5C-bit is set is to 'dub' the stream via the S-Video, as I had already learned to do from a standard set-top box, via a tv-tuner/capture card.

Hmmm...so I've finally concluded that a tv-tuner/capture card is the preferred approach. This allows you to be able to record anything that you're paying to receive, such as channels ABOVE 125, HBO, etc.

Such cards come in a variety of types: Analog, digital, hybrid, and personal. And, of course, various models can attach via the PCI-bus or the USB-bus. Also, note that there are various FUNCTIONAL categories, such as TV-viewing, TV-recording, and TV-grabbing (frame-grabbing), to name just a few. Some of the varieties allow you to do MULTIPLE functions (e.g. viewing and recording, etc). These varieties are illustrated in the link below:

Let's assume that, like me, you have a set-top box (either rented from your cable or satellite TV provider or else purchased). And, that, like me, you've purchased a video-capture card of some sort for your PC.

My first hardware purchase was a Sabrent "SBT-TVFM FM Radio /TV Tuner PCI Capture Card" (via EBay, for $14.00 + $5 shipping). This thing is normally only $26 retail...a true LOW-end offering. But, it met my needs, initially. [It comes with a remote-control and can tune FM and TV, via either an antenna or coax (cable/satellite) input. It also has inputs for composite-video and s-video and audio-in, so one could capture from a VCR, set-top, or DVD-player.] Some Internet googling claimed that it is supported on Linux (as well as on Windows, of course). It is based upon the Philips SAA-7134 chipset. I can now confirm that it DOES indeed work acceptably on WinXP (tho the software is only average quality). And, it is supported on Linux (as card=42 tuner=69 to the 'saa7134' driver). I now can get it to view channels on Linux (using any of 'kdetv','tvtime', and 'xawtv' TV-viewers with that configured driver).

My second hardware purchase was a Hauppauge WinTV-PVR USB2. (I got a very good deal...bought it on clearance sale at Circuit City in NH, for $63. Just like the Sabrent tv-tuner/capture, this one works just great on WinXP...install the Windows driver and software and go.) This is my preferred one, by far, and I use this one exclusively now. I particularly LIKE the fact that it is USB-based, so everything is more flexible and portable, and it can be quickly attached to either a laptop or desktop PC.

Doing the captures on Linux was a steeper learning-curve. After struggling trying to do the captures under Linux (and fighting with MythTV), I switched to doing the TV-capturing from WinXP, and then re-boot over to Linux and do all the remaining processing (e.g. massaging video-files, and creating CDs/DVDs) there. This is working well! Later, I moved to doing the 'DVDStyler' work also on WinXP, as I'm finding it easier to get the newer versions of most 'cross-platform' tools first for WinXP, as Linux repositories are slower to provide the newest versions for Linux users. [Note: To solve the data-movement issue, my WinXP partition is mountable from Linux, using the newer 'ntfs-3g' support, so that I can push/pull data to/from Windows while booted under Linux. Conversely, using 'ltools', I can push/pull data to/from Linux while booted under Windows. And, I've come to prefer dual-boot over running the alternate virtually, (using e.g. VMware-server or Virtual-Box), since I re-install Linux relatively frequently...typically, every six-months.]

The 'pvrusb2' usage doc for my Hauppauge device is located here
Linux's tuner-chip module for this device is 'cx2580'. One discovers these facts by examining these keywords in 'dmesg': In addition to module 'pvrusb2', these additional modprobe-able modules are there: cx25840 / tuner / tda9887 / tveeprom. Like other capture-cards, a generic device gets created for 'pvrusb2' driver: '/dev/video0' And from that driver-doc, these recommended cmds for TV-displaying do WORK:
mplayer /dev/video0
vlc < /dev/video0
kaffeine fifo:/dev/video0#demux:mpeg
This device, like the first, comes with the familiar 'remote control' to change channels, volume, etc, etc. So, I installed the software package 'lirc' (Linux Infra-red Remote Control), but the remote-control does NOT yet work on Linux. [sigh] One rumor was that I might be missing some 'kernel-level' lirc thing!? Need to re-test, now that the 'lircd' is setup to run at boot-time! Luckily, I could just leave that tuner on chan-3, and EXTERNALLY control the cable (set-top) box to change channels!

I finally DID get capture working on Linux, using 'mplayer/mencoder', which supports the 'pvr://' mechanism to hookup to the pvrusb2 driver for my device. There is some great info on the technique that I finally got working (just by substituting 'pvr://' for their 'dvb://') as discussed here:

The mplayer/mencoder docs specifically show support for processing of 'closed caption' info, via the '-subcc' argument. 'Closed-caption' info is also referred to as 'vbi' info (vertical-blanking-interval). More Internet researching indicated that only two models in Hauppauge's offerings support capture of closed-caption data...i.e. the PVR-250 and PVR-350. And, these models are now discontinued, as a whole new line of products are becoming available, that are more compatible with the conversion to 'digital television' here in the US. [Sigh.] This vbi/closed-caption-capture ability is becoming a important feature for me, so one of these days, I'll sell off my 'PVR-USB2' and get me one of those models that supports this! [Don't waste your time reading their specs...vbi/closed-captioning is rarely mentioned. And, when I sent an email to Hauppauge-support, they didn't even know that any of their products supported it.] I initially found it a bit strange that only these two PCI-bus products support vbi/closed-caption capture. Evidently, I'm one of the few who care much about this feature. I plan to buy a newer-technology unit soon, and I'll make sure that either the Linux-driver or the Windows-driver has implemented capture of the vbi/closed-caption data stream.

Recording a live stream

Recording induces "sync" problems with streaming-content, where audio is then delayed throughout the whole stream by a random amount (sometimes, by as much as 8 to 10 seconds). It's an induced deterrent to recording, I'm think. So, I needed to alter the relative delay between AUDIO and VIDEO tracks of a captured .MP4 stream. Both 'ffmpeg' and 'mencoder' tools have option(s) that CLAIM they can do that. First try, was to just try using ffmpeg, via a generic 'ffmpeg' template cmd, like:
ffmpeg -i Stream-captured.mp4 -target ntsc-dvd Stream-result-ffmpeg.mp4
but the output file grew LARGER by a factor of 10 over the input file! I didn't yet know WHY, but then I read that 'mencoder' is more powerful and should avoid doing as much 'transcoding'. I think it was a combo of audio and video format-diffs that explain why the file got so much larger. So I switched to a 'mencoder' cmd like:
mencoder -delay +8.4 Stream-captured.mp4 -ovc copy -oac mp3lame -o Stream-final.mp4
and this seems to solve it. (The output file DOES grow larger, by a factor of about 30%.) [Note: The 'manpage' for mencoder also suggests a very similar option -audio-delay , but I couldn't get that to work at all.]
Another HINT: Along the way, during trial-and-error mencoder runs (for finding a decent 'delay' value), I discovered that it is much FASTER to use '-oac pcm' for the audio-substream (tho, file will be LARGER by factor of 5). But, then for the FINAL post-production, I use the "-oac mp3lame", to achieve a much smaller file.

Alternate viewers

The standard viewing software used fir viewing video files is "VLC", from VideoLan. But, there are alternate tools to use for viewing and/or streaming/broadcasting videos. Though I've never seriously used these, they've been recommended to me by a friend