Better Living Through Technology: a blog dedicated to emerging
technology trends in hardware, software, webware, marketing and beyond
 
 
 



« Netflix's Irrelevant Account Upgrade Email | Main | Gadgets Tuesday Podcast »

Apple TV not playing nice with h.264 CAVLC content?
Benjamin J. Higginbotham
When the Apple TV came out I rushed to buy one.  Technology Evangelist shoots all our videos in 1080p and distributes 480p, 720p and 1080p versions of our material.  On paper it looked like our stuff would work, but you never know until you try, right?  To my delight everything worked as it should and I was able to see our material in all it's 720p glory.  After watching the content a bit I noticed a few areas we could improve in our encoding, so I set out to create new encoding profiles.  Since the Apple TV supports the h.264 main profile using CAVLC I figured I would use that.  Turns out that Apple TV does not seem to like CAVLC so much.

So what the heck is CAVLC and why do we care?  CAVLC and CABAC are methods of encoding video using the h.264 CODEC that allows for lossless compression.  Apple TV does not support CABAC so I'll ignore that for the sake of this article.  CAVLC stands for  Context-Adaptive Variable Length Encoding and is part of the main and high profiles in h.264.  There are many profiles but we basically concentrate on three:  baseline, main and high.  Baseline is the entry level profile designed for low end encoding for things like cell phones, or devices without hardware supported rendering (I'm generalizing here).  Until now we have been forced to use baseline h.264 profiles since the iPod didn't support anything higher than that.  The second one, main profile is a step up and allows us to select longer GOP structures (how many real frames vs. virtual frames we use) as well as CAVLC or CABAC encoding.  Main profile is basically for broadcast TV and slightly higher-end applications allowing for more complex decoding of the file. And then high profile takes it a step further and allows things like color space (4:2:0, 4:2:2, etc) and is designed more for broadcast archiving of files or really high-quality video at higher bitrates.  When I read that Apple TV supported main profile CAVLC I was excited because now I would be able to update my encoding presets to take advantage of what the higher profile had to offer.  Since CAVLC is a lossless compression technique I was hoping I could get a little more quality out of our videos at the same or maybe less bitrate.  Things like solid blacks were breaking up before, I thought this may fix it.  CAVLC looks great, but it has some pretty serious problems on the Apple TV.

Our original videos have all been encoded up to this point using Sorenson Squeeze 4.5 as an h.264 baseline profile.  I have wanted to upgrade to the main profile CAVLC but Squeeze isn't very good at actually setting that up.  Recently we purchased Telestream's Episode Pro to help improve our workflow, get Apple iPod and Sony PSP support as well as give us more CODEC options.  I ran a couple of test encodes using Episode Pro as an MPEG 4 h.264 main profile CAVLC encode and the files looked stunning.  I was excited to try these on the Apple TV so I added them to my iTunes library.  They all popped over to the Apple TV no problem.  I then went to my Apple TV, selected the first file, and the whole unit stalled.  After about 60 to 90 seconds the Apple TV responded again and I could move to the next video in the list or play the CAVLC encoded file.  If I hit play then I would have to wait another 60 to 90 seconds before the file would begin to play.  Once it started playing everything seemed to work fine, and it looked stunning.  The problem is that I can't have our content causing everyone's Apple TV to stall out every time they pass over a clip!  If I take that exact same clip and don't change any settings other than moving it to a baseline profile, then it will work fine on the Apple TV.  Nice and snappy.

I heard rumors that the new QuickTime Export to Apple TV feature used CAVLC to encode, but I have no way to test and see how it's really encoding yet.  I ran a test encode and content that spits out of QuickTime Pro is nice and snappy as well, so I'll assume that they are using a baseline profile.  Has anyone else seen this problem or have any ideas how I can troubleshoot something of this nature?  I posted to the Apple support forum, but that has gone unanswered.  I want to be able to deliver our content to everyone using the least amount of bandwidth at the highest possible quality.  Anything I can do to improve upon the videos is welcome, but having the video lock the Apple TV for a minute or two is not an acceptable solution.

If you would like to see exactly what I'm talking about, I have uploaded our test clips to the MoveDigital network.  You can download each clip (there are multiple clip settings for b-frames, bitrate, etc) at: http://www.movedigital.com/go/benjaminhigginbotham/58340.  The first video in there is a baseline video which should work, the rest are all main profile CAVLC.  Right now I just need to determine if it's an Apple TV issue or Telestream's implementation of h.264 that's causing the problem.  If anyone is able to re-compress the videos and try a CAVLC encode, it would be greatly appreciated.



TrackBack

TrackBack URL for this entry:
http://www.technologyevangelist.com/cgi-bin/mt-tb.fcgi/873

Comments

1. Posted by: anonymous on April 4, 2007 9:35 AM:

FYI:
Baseline supports CAVLC
Main supports CAVLC & CABAC
High supports CAVLC & CABAC


Maybe you mean CABAC, but in most cases an entropy encoding mode either completely works or doesn't unless the processor is running out of time. My guess is you may be having problems with the Main Profile due to B slices or one of the direct prediction modes that isn't completely supported.




2. Posted by: Jeff Brown on April 4, 2007 4:42 PM:

Long and variable GOP size can cause some of the problems you are seeing. I have noticed that if you let the encoder do automatic keyframe generation you get a very efficient encode but the computational requirments for decoding can be pretty high due to the need to parse very long GOPs. If you force a fixed keyframe rate so you're getting say, 30-frame GOPs it can reduce the playback burden. Don't know if this is relevant in your situation but perhaps it's worth a look. I've noticed that Apple limits GOP length on their videos.

BTW, I really do marvel at how well the encoder is handling moving traffic in front of the Sun truck at such low bit rates. The Saint Thomas University building also looks pretty good for a low-contrast background feature.




3. Posted by: Benjamin J. Higginbotham on April 5, 2007 2:04 AM:

Jeff, that's a great idea, I'll try forcing keyframes to see if I can shorten up that GOP a bit. I use natural keyframes to try and make the GOP as long as possible and keep the bitrate down, hopefully additional I-Frames won't burden the stream too much.

I have been very pleased with how well the h.264 CODEC has been performing. I have been surprised at the quality of the content we're able to get out for under 2Mbps. We're switching to a new encoding profile, so hopefully it will just start to look better and better too!




Post a comment

Required fields marked with: *
Name*:


Email Address*:


URL:
Remember personal info?

Comments*:

HTML Tags you can use in your posts:
<b>Bold</b> = Bold
<i>Italicized</i> = Italicized
<a href="http://www.othersite.com">Link to Other Site</a> = Link to Other Site


Please keep comments on-topic. Contact authors or other commenters
directly for off-topic conversations.

Notify me of future comments via e-mail



Technology Evangelist Digest - Free Newsletter
Sign up for the free Technology Evangelist Digest to receive daily updates, editorials, and practical advice on emerging technology trends in hardware, software, webware, marketing and beyond.

Technology Evangelist Digest will keep you up to date on the technology trends that will help make you more productive and efficient both in business and your personal life.

Let's face it: If you made it to this line, you must have found something valuable on this page, right? Think about how cool it would be to have something free and interesting to read every day from Technology Evangelist by signing up today.

1. Fill in your email below,
2. Then click on the confirmation email you receive.
3. That's it. Your first Technology Evangelist Digest will arrive within 24 hours.




Previous Entries:


Tag Cloud