Archive for February, 2008

Video Compression and VCR Capture

Wednesday, February 27th, 2008

Recently I decided to save disk space by archiving recorded TV to DVDs and of course some of the files were too big to fit on a standard 4.3GB DVD, so I needed to compress the files.  I also thought that it would be a good idea to copy some old VCRs to DVDs so that they could be viewed more easily.  So I had to find suitable codecs and software to capture analogue recordings, compress videos and trim them to size.  This all proved tricky to get right so I thought I would document what I found.

So first I had to find a codec to compress the Recorded TV from the DVR-MS files and I soon settled on the free Xvid MPEG4 compressor from http://www.xvid.org.  But then I had trouble converting from MPEG2 and found various issues with timing, audio sync, picture chopping, etc.  The standard Microsoft MPEG2 codec didn’t work and neither did FFDShow, Nvidia or an old version of CyberLink; the only codec I found to work was CyberLink PowerDVD 8.0.1918.  I tested this out with GraphEdit and then found the free Prism conversion software at http://www.nchsoftware.com/prism but unfortunately the video is speeded up with Prism and I haven’t been able to get that working yet.  The standard Xvid compression worked well compressing to 40% of the original with little loss of quality.  On one file I set the compression index to 6 and achieved a 35% compression.  The compression took some time; about twice as long as the actual recording.

 So next I looked into VCR capture.  I have a Dvico Digital TV Card and this has an analogue input so I tried this.  I eventually managed to get GraphEdit working but needed to use the “Smart Tee” to view while capturing and then I found the opensource VirtualDub software.  I found problems getting the audio to sync using this but found that a modified version “VirtualDub VCR+Sync” worked OK (see http://www.virtualdub.net/download.htm).  I again used the Xvid codec for compression and found that it was necessary to set the usage to “real time”.  I also found the sound was messed up with the MPEG Layer3 audio compressor, so I used PCM and that worked fine.   I then wanted to split the video recordings into separate episodes and found that VitualDub could achieve this but I found the freeware AVITrimmer easier to use (see http://www.solveigmm.com/?Products&p=AVITrimmer).

The other thing about capturing from the VCR was that performance constraints made it impractical to view on the PC and so I rigged up the UHF output of the VCR to a TV.

So now I am happy that I have all the software and codecs to achieve video capture and compression but was surprised how difficult it was to find the right combination of tools.

Video Format, Codecs, Filters, Graphs and Container Files

Wednesday, February 20th, 2008

Playing and manipulating videos in Media Center (MC) or WMP requires that certain DirectShow filters are installed and these do not always get included as standard.  I have found a lot of conflicting advice and descriptions so I thought I would document what I have learnt.Video is stored in many different formats and files.  The base format of video typically for TV tuner hardware or DVDs is MPEG-2 and High Definition (HD) tends to be MPEG-4; a Microsoft format is WMV3.  The raw video is then compressed using a Codec (Compressor/Decompressor) and some well known compression formats are Divx and Xvid.  Divx and Xvid are codecs for MPEG-4.  Audio is stored in a number of ways as well, such as MPEG1 Layer-3 (MP3), MPEG2 Audio or AC3.  The video and audio is then stored in a container file, along with meta-data like title and duration.  Container files have extensions such as AVI, WMV, MPG, MOV, DVR-MS etc.  AVI files can contain several streams in various formats, including Xvid, MPEG-2, MP3 and AC3 so just seeing an AVI extension doesn’t reveal the internal format.  Recorded TV in MC is stored in a DVR-MS file which is like an AVI with un-compressed MPEG-2 video.  The DVR-MS file is encrypted so that copy protection may be applied.MC, WMP and other video software use Microsoft DirectShow to render the audio and video.  DirectShow uses a “Filter Graph” to process a file and this is a set of filters linked together.  Typically to play a video, a filter reads the file and passes it to a splitter to split audio and video; the video is then decompressed by a codec and the audio is converted via an audio filter; both streams are then rendered by respective filters.  A tool from Microsoft called GraphEdit can be used to view, manipulate and activate filter graphs.

The main codec that was required for MCE was for MPEG-2 and I used CyberLink PowerDVD SE which came as PowerPacks and worked fine.  Sometimes CyberLink PowerDVD 7.2 or Nvidia PureVideo is recommended for VMC but Vista includes an MPEG-2 decoder from Microsoft.  I have found that I have needed to install an AC3 audio filter (AC3 Filter from http://www.free-codecs.com) to process certain DVR-MS files for some Australian TV channels.  FFDShow is open source software that provides a number of useful codecs and filters.

 

Typically software to play videos will automatically select codecs but a tool called DecCheck from Microsoft will set the MPEG-2 codec for MCE and there is an alternative tool for VMC called VMCD.

 

Generally my advice is to install the minimum of codecs and filters that you can get away with.  I hope that this note gives an introduction to this topic and I hope to post more specific information about codecs in future blogs.

Blogging Server Software

Wednesday, February 13th, 2008

Well a couple of days ago I started searching for software to use to deliver my blog and I have a solution I am happy with.  The problem with MySpace and Facebook is that they are better for sharing with a few friends rather than the wider public; the MySpace blog did not transfer to Facebook either.  I found a site at http://wordpress.orgthat delivered a managed blogging service and this looked like a good general solution.  WordPress also had a PHP version of the server software and I have downloaded this to my Linux server.

I am now using WordPress on my server to publish this blog.  There is also an RSS feed provided and I have linked this into Facebook and my blogs are appearing as Facebook notes automatically.  This all seems to work very well and I can recommend the solution.

What is Media Center and will it catch on?

Monday, February 11th, 2008

Media Center is software from Microsoft to display TV and other media on a PC.  The software provides an interface designed to be viewed from a distance and controlled with a remote control handset.  This type of device is sometimes referred to as a Home Theatre PC (HTPC).  Media Center was first supplied as an OEM extension to Windows XP called Media Center Edition (MCE) and now Vista Home Premium and Vista Ultimate include a new version of Media Center (VMC).  I will refer to MCE and VMC as MC for the remainer of this note.

MC functions much like a Personal Video Recorder (PVR) with a hard disk to record TV and buffer live TV to provide pause and rewind facilities.  MC, however, is much more flexible than a PVR and supports many different types of media, including videos, photos and music.

So what is required to make an MC PC?  In order to watch TV, a tuner card is needed and it is best to have two tuners so that one channel can be recorded whilst watching another.  If your country supports it, I would install digital TV tuners (DVB-T).  As an alternative, cable TV cards can be installed.  Next you need a large screen to use as a TV and a good video card to drive it.  Sound is also important and the best configuration is to use a sound card with an S/PDIF optical or coax digital output connected to a 5.1 multi-channel audio amplifier.  Normally audio amplifiers include an AM/FM radio tuner but if you want radio in MC a ratio tuner card is needed (sometimes this is included with analogue TV cards but not the digital ones.

With this setup you have a MC that can be used to watch and record TV, including pausing live TV.  You can watch DVDs (provided you have a DVD player in the PC).  Music can be copied from CDs (ripped) to the MC and thereafter played.  Photos can be copied to the MC and displayed (optionally accompanied by music).  On top of this there are other features as standard and third party additions.

A really great feature of MC is the TV Electronic Program Guide (EPG) and this allows an on-screen display of what is showing and scheduled for each channel.  To record a program you just select if and press the record button (twice to record the series).  The EPG makes viewing and recording TV so easy.  Unfortunately in Australia, where I live, the EPG is not provided by the TV broadcasters or by Microsoft, however it is possible to setup an EPG using IceTV or Free*EPG.  More information on the Australian EPG and loads of good stuff on MC can be found at http://www.xpmediacentre.com.au.  General information on MC is also at http://thegreenbutton.com.  I download my own copy of an EPG from the Internet using a purpose written program and I may make this available at some stage.

 So why isn’t everyone using Media Center?  I think MC is a great product but I would be the first to admit that it is difficult to build and maintain.  In Australia many people use Foxtel IQ for cable TV and that is much easier to use “out of the box” than MC.  There is little marketing for MC and it needs good technical knowledge to keep MC operational.

I belive that for MC to catch on (in Australia at least) it needs a major supplier to sell a “ready to go” VMC PC, the EPG needs to be available to all and a serious marketing drive is required.  Unless this happens, Media Center use will be retricted to a limited number of computer gurus.   

Blogging

Sunday, February 10th, 2008

I have decided to start a blog to discuss various things but probably concentrating on Microsoft Media Center and VMC and maybe a bit on Sudoku and the English language round the world.

Well the first decision is where and how to host the blog; so I have setup accounts on Facebook and MySpace to try them out.  The other alternative is to try some Linux software on my own web server.  At first glance it looks like MySpace has a good area for blogs but Facebook only has notes.  Maybe I create the blog on MySpace and then copy to Facebook?  Facebook needs an RSS or Atom feed so I will have to see how I can achieve this.

For Linux I haven’t found a good blogging server yet but this may be the best approach.

When I have worked this out I will create a blog on blogging and where to put the blog.