Oct 18 09

Converting .wtv to .mpg in Windows 7

by Mathew

I use a PlayStation 3 to watch TV programmes recorded in Windows 7.  The media sharing functionality in 7 is much better than in Vista, and it’s quite simple to share the Recorded TV folder and watch .wtv files on the PS3. However, I prefer to convert the .wtv files to .mpg, and use the excellent PS3 Media Centre to serve them. In my experience, .wtv files on the PS3 are:

  • Slow: I find that fast-forwarding or using the “scene search” functionality lags much more than when watching .mpg files.
  • Not pretty: To my eye, .wtv files are blockier (on the PS3) than the .mpgs I create.
  • Bigger: 3.5 hours of HD Sunday Night Football creates a .wtv file of around 20GB. After converting to .mpg the file is about 18GB. This is trivial with the cost of storage at the moment, but it’s interesting nonetheless.

The WTV format is relatively new, having replaced the DVR-MS format that Windows used previously. Windows 7 provides the functionality to convert .wtv files “back” to .dvr-ms files, and to do so is as easy as right-clicking the source file and selecting “Convert to dvr-ms Format”. This is crucial functionality since, while WTV is completely new, DVR-MS is based on the well-known ASF format. This makes it easy to retrieve the core MPEG2 data.

To produce a .mpg file from a .dvr-ms file, we can use ffmpeg from the command line:

ffmpeg.exe -y -i "showname.dvr-ms" -vcodec copy -acodec copy -f dvd "showname.mpg"

Here are the options explained (taken from ffmpeg’s documentation):

-y                  overwrite output files
-i filename         input file name
-vcodec codec       force video codec ('copy' to copy stream)
-acodec codec       force audio codec ('copy' to copy stream)
-f fmt              force format

Essentially I’m telling ffmpeg to copy the audio and video streams just as they are, and to put them into DVD format (MPEG2). It doesn’t perform any re-encoding, so it quickly produces a nice .mpg file that plays natively and perfectly on my PS3.

I quickly tired of having to complete a two-step process  to watch a TV show, and I wrote a batch script to do the lot at once. For each .wtv file in my Recorded TV folder, it will:

  • Create a temporary .dvr-ms file from the .wtv file (using the core WTVConverter program provided by Windows 7)
  • Create a .mpg file from the .dvr-ms file (using ffmpeg)
  • Delete the .dvr-ms file
  • Move the .mpg file to a different directory

To use this script just paste it into a .bat file and change the paths accordingly. You shouldn’t need to change the value of wtvconv.

@echo off

set recordedtv="D:\Recorded TV\"
set destfolder="D:\taped\"
set ffmpeg="C:\programs\ffmpeg\ffmpeg.exe"
set wtvconv="C:\Windows\ehome\WTVConverter.exe"

for %%f in (%recordedtv%*.wtv) do (
	%wtvconv% "%%f" "%%f.dvr-ms"
	%ffmpeg% -y -i "%%f.dvr-ms" -vcodec copy -acodec copy -f dvd "%%f.mpg"
	del "%%f.dvr-ms"
	move "%%f.mpg" %destfolder%
)

I have thought about having it delete the .wtv files, too, but I prefer to check that the conversion has worked before deleting them manually. On rare occasions the process has failed with no explanation, but simply running it again has done the trick.

A couple of caveats, now. I have found that recent versions of ffmpeg sometimes fail during conversion with “error, non-monotone timestamps.” I found a solution from another blogger, who suggested downloading an older version from here. I don’t know why or how, but this works for me.

Secondly – and seemingly only when converting high-def video – ffmpeg sometimes complains, “packet too large, ignoring buffer limits to mux it“, yet still appears to do the job correctly. I assume that this has something to do with the default buffer size used in DVD creation, but I haven’t found a way to fix it. It doesn’t seem to cause any problems, but for completeness’ sake I’d like the solution. Please let me know if you can help!

Finally, I anticipate the question, “why don’t you just use a program that records directly to .mpg?” Well, I have. I’ve used GB-PVR, for example, and combined it with a variety of multiplexers. To my eyes the quality has never matched the output produced by Windows Media Centre. This has more to do with the multiplexers than the application, of course, but I also prefer using Media Centre to browse and schedule recordings. This is the best solution I’ve found to suit my preferences (so far).

Aug 5 09

The Ashes urn is not a trophy

by Mathew

Whenever Australia wins or retains the Ashes, people call for “the urn” to be sent home with the team, believing it to be a trophy. It’s an understandable assumption, but the urn’s history shows that they are incorrect.

The Sporting Times 02/09/1882 (The Ashes)

Most cricket fans know the story – after Australia beat England in an 1882 test match, a mock obituary appeared in The Sporting Times “in Affectionate Remembrance of English Cricket”. The final line of the obituary reads, “The body will be cremated and the Ashes taken to Australia”. Thus began one of the most enduring sports legends.

The obituary was a great joke, and English captain Ivo Bligh (later to become Lord Darnley) declared that he’d regain “the Ashes” when England toured Australia in 1882-83. He referred to “the Ashes” several times during the tour, and the Australian media ran with it. The term then fell out of use for twenty years before being cemented by English captain Plum Warner when he published How We Recovered The Ashes in 1903.

The Ashes legend was forty-five years old when the general public became aware of a certain urn. The following poem, appearing in The Cricketers Annual in 1925, indicates as much:

So here’s to Chapman, Hendren and Hobbs,
Gilligan, Woolley and Hearne:
May they bring back to the Motherland,
The ashes which have no urn!

(For the record, England was thumped 4-1.)

In 1927 Florence Bligh, widow of Ivo Bligh, gave the Marylebone Cricket Club a small terracotta urn that had been given to her husband some years prior. Although the details are disputed it is believed that a group of Victorian women, picking up on the “ashes” term used by the media, awarded him the urn after England’s series victory in 1883.

The urn was a personal gift to Bligh, and was later a personal gift to the MCC. It is known as the “Darnley urn” to distinguish it from other, less celebrated urns that have surfaced over the years.

The Darnley urn was kept in the Long Room at Lord’s until 1953, when it was moved to the MCC Museum at the same ground. Its prominence has led many to assume that the test series is named for it alone, and they believe it to be the trophy.  The Ashes, however, are metaphorical. It is an idea created by The Sporting Times, and one which grew in stature as it collected more stories. The Darnley urn is just one of those stories.

The Darnley Urn

No doubt there are those who would read this and say, “so what?” Despite the history, they would claim that the Darnley urn has come to represent the Ashes for most people and should therefore be considered a trophy. I do not agree.

The urn is delicate and belongs in a museum so that it can be correctly maintained. The MCC respected the wishes of the Australian public and created a large replica trophy of Waterford Crystal to award to victorious teams. If we must have a trophy, this is more suitable than a 125-year-old terracotta artefact.

I don’t understand the attraction to trophies. I believe that the idea is more compelling than a trophy could ever be. The death of English cricket! What a notion! Since 1882 we’ve been playing tests to either regain England’s honour, or to rub her nose in it some more (depending on whose side you’re on). How simply marvellous. I doubt I’ll convince many of my fellow Australians to come around to my way of thinking; we’re too fixated on the physical, on ownership, on possession. If people know the history, though, we can debate these last points alone.

Jul 27 09

Australian copyright law is ridiculous

by Mathew

For a number of years it was illegal for an Australian to tape the footy and watch it later. At one time it was also illegal to copy music from a CD and onto an iPod. This sort of innocuous activity (known as format-shifting) was eventually permitted by amendments to the Copyright Act 1968. Mostly.

By Schedule 6, Part 2 of the Copyright Amendment Act 2006, “Reproducing copyright material in different format for private use”, the following activities are allowed:

  • “Recording broadcasts for replaying at more convenient time” (such as taping the footy)
  • “Reproducing works in books, newspapers and periodical publications in different form for private use” (such as photocopying an article)
  • “Reproducing photograph in different format for private use” (scanning a hard-copy photo or printing out a digital photo)
  • “Copying sound recordings for private and domestic use” (ripping a CD onto an iPod)
  • “Copying cinematograph film in different format for private use” (coping a film from a VHS tape onto a DVD)

There is a glaring omission here – films on DVD and BD (blu-ray disc) are not mentioned. It’s still illegal to copy a film from a commercial DVD to another format or to another disc, even solely for your own use. If you have a portable video player (like an iPod or an iPhone) it’s illegal for you to rip films onto it. You are legally bound to watch the film through a DVD player.

Parents with young children might think to create a backup of their Spongebob Squarepants DVD, hiding the purchased copy safely out of the way lest their kids accidentally scratch or snap it. Some people may own home theatre PCs, and would like to copy their DVDs to its hard drive, allowing them to browse and play their entire collection from one location. Unfortunately, these are both illegal. When we buy a film on DVD we buy the right to watch it only via that DVD.

The law obviously recognises the value of format-shifting. It understands that there ought to be exceptions to copyright – for reasons of convenience, practicality, or protection of works – as long as it doesn’t hurt the copyright holder. It acknowledges that private use does not adversely affect the copyright holder’s capacity to make a buck (as might be the case if you were to sell bootleg copies). The law therefore allows us to put songs on our iPods, and I can’t see why it should be any different with DVDs or BDs. Surely the same principle should apply?

Perhaps it has something to do with the support that Apple’s iTunes enjoys from numerous music labels, and the lack of an equivalent service for films. One suspects that we wouldn’t have been allowed to rip CDs, either, if not for the existence of iPods.

It’s certainly not an oversight, because the Act drives the point home. DVDs and BDs often include some kind of digital rights management (DRM), to prevent us from copying our own discs. In Schedule 6, Part 2, Subdivision F of the Copyright Amendment Act 2006, “removing or altering electronic rights management information” is listed as in indictable offence (unless you have the permission of the copyright holder). Not only do the film studios block people from copying their films for private use, the Act gives their DRM mechanisms legal protection.

The difference between the private use rights of CDs and DVDs is inexplicable. My conclusion is that copyright law (or parts of it) is dictated by the big players in the film and music industries. In the words of a friend, “the people with the money and intent write the laws.” This is an unfortunate situation. Copyright exists to protect innovation, not to ensure that media conglomerates can sell the same person the same work again and again and again.

A reasonable person would have no moral or ethical problem with format-shifting media they’ve already bought. The Act itself acknowledges this by the way it treats CDs. That the same principle hasn’t been applied to other forms of optical media is disgraceful, as it suggests that film studios had their hands in the legislation.

For more information check out the fact sheets provided by the Australian Copyright Council.

May 13 09

Unbricking a Seagate Barracuda

by Mathew

Recently, one of my hard disks ‘disappeared’ from my computer – it was not being detected in the BIOS. It turned out that this was a known issue with my drive, and one for which Seagate had released a firmware update.

Unfortunately, the update could only be applied to functioning drives. Seagate will apply the fix to bricked drives for free, but I was reluctant to send my drive to them because I didn’t want to give strangers access to my personal information. I wanted to do it myself.

After a bit of a search I came across this enormous thread. The first post has changed quite a bit since I first saw it – it initially contained a lot of true and false information, and the same followed in the rest of the thread. I spent some time cross-referencing the various opinions and experiences, and finally managed to unbrick my drive.

I had intended to provide a how-to here but I have since discovered that someone has already done it. What I did was pretty much the same as the author of that guide, except that I used a USB cable instead of a serial adapter.

I found myself a Nokia data cable (DKU-5) and cut off the phone end. With the help of a multimeter I determined which wires were used for transmit, receive and ground, and connected them to some wires I cut off an internal CD-ROM cable. These wires were attached to jumper pins, which I was able to slot into the hard disk. The USB end plugged into my computer, and I was able to connect to my hard disk via putty.

Apart from that, the steps I followed are identical to the guide above. I don’t recommend that people do it – if you have this problem and aren’t wearing a tinfoil hat, send it back to Seagate to safely recover your data.

Here are a few photos that I took during the operation.