Tuesday, April 08, 2008

Elgato's Turbo.264, Toast 9, TiVo Butler, and MPEG Streamclip

The Elgato Turbo.264 is a Mac hardware accelerator, a "USB Stick" smaller than a cell phone. It is designed to speed up a Mac conversion of videos in assorted formats, including the MPEG-2 "muxed" format used for TiVoToGo files, to the space-stingy MPEG-4/h.264 format iTunes uses and also can sync to your iPod, iPhone, or Apple TV. The same h.264 format works with the Sony PlayStation Portable.

I bought a T.264 for $89.99 at Amazon.com. I wanted it since I am doing a lot of converting of TV shows recorded on my TiVo Series3 DVR. I'd like to play them, via iTunes on my MacBook Pro, on my Apple TV.

The T.264 simply plugs directly into a USB 2.0 port on the Mac (or, if access is tight, Elgato supplies a short cable to make the connection). If your Mac is an older one with USB 1.4, not 2.0, the T.264 will work with it, but its ability to speed up conversions is crippled.

The T.264 comes with its own general purpose Turbo.264 video conversion software, but I'm not using that. I'm using Roxio's Toast 9 Titanium, for the simple reason that Toast's various software applications can transfer encrypted TiVo files to the Mac, decode them, edit them, and convert them ... using the T.264, if available. Toast 9 presently has an introductory price of $79.99.

I'm also using the T.264 with a combination of TiVo Butler to transfer and decode the recordings and MPEG Streamclip 1.9.1 to edit and convert them. More on that combination, both of whose software pieces are free, as we go along.

The T.264 hardware/software combo piggybacks on Apple's $19.99 QuickTime MPEG-2 Playback Component, which some converters don't plug into. (Elgato's conversion app, when you first open it, creates yet another add-on QuickTime module called Elgato Turbo.component, which I assume provides the MPEG-2 to h.264 conversion capability.) For the T.264 hardware to come into play, the video conversion software you are using must leverage Elgato's proprietary QuickTime component and Apple's QuickTime MPEG-2 component. Toast 9 does so. So does MPEG Streamclip.

TiVo Butler does not. So although it is capable of converting .tivo files to MPEG-4/h.264 files, it does it the slow way, not using the accelerator. Also, TiVo Butler has no way to edit the files prior to conversion.

The degree to which the T.264 speeds things up varies with a number of factors, some of which are a mystery to me. One of the factors is the CPU speed of your Mac itself. Obviously, if your Mac is super-fast at doing a software-only h.264 conversion, the amount of speedup you get with the T.264 is accordingly reduced. My MacBook Pro Intel Core Duo laptop saw a 20% speedup when I performed a test conversion, once with the T.264 and once without, in Toast.

It looks as if the speedup is much greater with MPEG Streamclip, which plugs into the Apple QuickTime MPEG-2 Playback thingy. Streamclip seems to do things a lot differently than the other software that I have tried. You open in Streamclip (say) a decoded .mpg file produced by TiVo Butler (which has been set up not to do the conversion itself). Then after optionally editing it in Streamclip to remove unwanted parts, you select File->Export to Other Formats to get Apple TV-compatible output. You see a complex dialog:



If you choose Apple TV (Elgato Turbo.264) as the format, you get the T.264 speedup. If you choose just Apple TV, you don't.

In one test I made, it took 55 minutes to export a small file without the Turbo, 14 minutes with. But there was an anomaly with the former test, in which the output video frame size could not be changed from an erroneous 960 x 540 pixels, for some reason. That meant Streamclip was wasting time scaling the video up from the original 640 x 480. Hence the timing comparison was almost certainly not valid.

Unfortunately, there are other problems with using the T.264 as well. One is a propensity to ruin portions of the video output by making the picture look like a mosaic of small, single-color square tiles. In my tests, this can happen with either Toast or MPEG Streamclip as the converter.

What seems to be happening is very possibly a mix-up concerning quantization.

All MPEG, whether MPEG-4/h.264, MPEG-2, or otherwise, deals in square "macroblocks" that are 16 pixels by 16 pixels. Every MPEG video frame is a collection of macroblocks. Each macroblock consists of four 8x8 blocks of "luma" information about black and white (and shades of gray), augmented by two 8x8 blocks of color information. (The latter are each spread over the entire four luma blocks.)

MPEG encoders perform complex math that changes each 8x8 block of pixels into a set of 64 coefficients, each of which is then "quantized" be dividing it by a number from an 8x8 matrix or table of quantizers. Each division's remainder is thrown away and the quotient is provided in the output stream. The decoder then receives the quotient and multiplies it by (supposedly) the original quantizer. The decoder is supposed to find the original quantizer matrix in the encoded MPEG stream it receives, and use it to perform the requisite inverse quantization. (There are also numbers provided in the MPEG stream which tell the decoder to add or subtract a constant amount from the quantizers in the matrix, until further notice.)

When something goes wrong, the quantization or the inverse thereof can come up with the wrong numbers. If all the numbers -- except one that is treated differently, the so-called DC coefficient, which tells what the average brightness or color is -- turn out to be zero, there is no brightness or color variation within the block. That's what I'm seeing in some portions of the video output from the Turbo.264.

Tests indicate that it happens every time I try to convert a particular input file that is prone to this problem, in exactly the same portion(s) of the video.

I have also found that editing the input stream to snip off most of the earlier and later video material and just include a problem portion can, depending on exactly how the brackets are set, avoid the problem. But if the editing brackets are set fairly wide, the problem recurs.

Undoubtedly, the trigger for the problem must be something that is messed up in the original input file ... not an unusual circumstance with TiVo recordings. That something may well be much earlier in the video stream than the point where the mosaic output begins.

For this reason concerning mosaic video output, I cannot really recommend the Elgato Turbo.264 for TiVoToGo users until Elgato tracks down the bug and fixes it. And that's a pity, since the product is otherwise a useful one.

6 comments:

Petar Smilajkov - Peconi said...

Thanks for this post ;) I was looking for exactly all you just wrote :)

Petar
http://iBetaTest.com/

joeleisen said...

Hi Eric,

I'm enjoying reading through all these posts on TTG, Elgato, MRV and Toast.

My setup is a wired network with three Tivos, an iMac and a bunch of other devices not relevant to this discussion (PS3, Denon receiver etc.).

I had been using Tivo Desktop on the VMFusion/XP side of the iMac for transfers, and I had not yet approached the .tivo conversion. I bought Toast 9 and it has worked far better than Desktop for intra-network transfers. However, when I made my first H.264 conversion of a transferred file, it was painfully slow (as you can imagine).

I've thought of getting the Elgato Turbo & checked out their site (and your warning about it not preserving all video quality). You wrote in this post, "the video conversion software you are using must leverage Elgato's proprietary QuickTime component and Apple's QuickTime MPEG-2 component. Toast 9 does so." On the Elgato website it specifies that the input format must be "Any movie that QuickTime plays (through codecs that ship with QuickTime as well as codecs that are supplied by third-party components like Flip4Mac)."

Well, if QTP played .tivo recordings I would not have run them through Toast in the first place, so now I am wondering how one would go about converting them using the Elgato & Toast. Is the idea that you transfer the recording & then do Toast conversion which would be handled on the hardware side (automagically??) by the Elgato? I am confused. Any help would be appreciated.

P.S. I could not agree more about the stupidity of the "one Tivo" limit on copy-protected programs under MRV. I am not broadcasting these programs to the world, just to my bedroom.

joeleisen said...

Oh snap, I just saw the "Use Elgato if present" under Preferences. Well, that settles that. Back to studying the post about whether the $90 is worth it.

eric said...

Joel,

Thanks for your kind words about my posts in your first of two comments.

I'm not familiar with VMFusion/XP. Would you like to give some more details in another comment?

I just got myself a PS3 and will be discussing it in this blog.

I'm not sure how new your iMac is (I have an old PowerPC-based iMac, and also an Intel-based MacBook Pro), but the newer Intel-based Macs (whether iMacs or otherwise) speed up h.264 conversions a lot.

Sadly, the Elgato Turbo just does not work reliably for me. It radically degrades the video quality -- i.e., unwatchable -- just in certain parts of certain videos. You can't tell which videos it will mess up until trying a conversion and then playing it all the way through to see whether there has been a problem. I would not buy it unless you want to deal with the hassle of returning it for full credit if you aren't satisfied.

joeleisen said...

"VMFusion and XP" was my shorthand for VMWare's Fusion alternative to Parallels (virtual machine on iMac; I use Win XP as the guest OS).

My iMac is brand new and hence it's obviously Intel-based. It even has added RAM so I was just trying to accelerate things a bit. I think you just saved me some $. Thanks.

Anonymous said...

try iTivo (itivo.googlecode.com) instead of tivo butler...

It will fetch from the tivo and encode with the elgato stick.. and it's free..