Thursday, 17 September 2009

Squish/unsquish: the black art of codecs

Video files. Honestly, who invented them?  They really are evil little critters.

Once upon a time we used to watch movies by shining a light through pictures moving very fast. Then we had this bright idea to start shooting electron beams at a magic tube and moving that back and forth very very fast.  Then we decided to convert everything into 1's and 0's, turn that into beams of light, fire them around the planet, under the sea, up into space, and into your home, and read them very very very very fast indeed.  This required us to invent a bunch of file formats, and then perform strange black magic rituals over them called compression and decompression so that we can squirt even more 1's and 0's around and read them even faster.

Which is where we get to codecs. (Compression and Decompression, you see.  Clever, huh?) Codecs are one of the Great Mysteries of Life when you're a video editor.  You use a codec to make your video file smaller (or maybe two, one for the video and one for the audio), and then the person at the other end uses the same one to read it. You can usually tweak your codec settings to give you different results: you can opt for bigger files and better quality, or smaller files and lower quality, or if you're really clever, dedicated, and willing to persevere, you can mess with keyframes and all sorts of settings to get the perfect balance.

So, why are we going on about this today?  Well, we're not happy with the video uploading to Moviestorm.  We support lots of video formats, but we don't support as many codecs as we'd like, and the end results aren't good enough. Low-quality video, sound sync problems, some videos simply not encoding... yeah, we know. 

So we messed around, tried various things to make it better, and gave up. Then we brought in a bunch of specialists, encoding.com, and we'll be using them to encode videos uploaded to Moviestorm.  This should enable us to support more videos and give us better quality streaming.  It'll also enable us to move to a two-stage encoding process, the same as you get on the big video sites like YouTube.  You'll get a low-quality version of your video pretty rapidly, and then that'll be replaced a higher-quality version a short while later.

It's worth taking a look at the video formats they support - and the ones they don't.  (Seriously, take a look, and see how many obscure or archaic video formats you don't even recognise.)  And, significantly, even though this is their area of expertise, they don't promise to support all codecs for any given video format. 

We're not sure when this will be up: we're still testing and ironing out a few bugs.  Last word we had from the team is "if it goes really well, maybe this week, if it doesn't, then maybe next week, if it goes really badly, then it won't be next week."  We're also working on assembling a list of known good (and bad) codecs and settings. However, this is a mammoth, time-consuming, mind-numbingly tedious task, and there's no way we'll get through all known codecs.  So far, we've tested the following, and are working our way through a bunch of others that we can get out of Premiere and Pinnacle (and Vegas if we have the time):

  • X-Vid video codec
  • MPEG-2 codec
  • MP4 codec
  • MP4 AVI Wrapped
  • 3gp codec
  • HD WMV
  • MP4 AVI Wrapped with space in title
  • Indeo 5.1 Codec
  • Quicktime sample
  • Cinepak codec
  • WMV with WMV9 & WMA10

When we get the new encoding up, we'll post the list on the forums and/or wiki - if you want to add your own codec experiences, successful or unsuccessful, that would be hugely, massively, mightily appreciated, by other Moviestormers as well as our QA team!

7 comments:

twak said...

aaawwwww.... ogg and h264 are "untrusted".

encoding.com also seems very confused between the concepts of a container and a codec

Evan Ryan said...

Regardless, this is a step in the right direction. I remember I tried uploading a WMV a while back and it got shot down. I hate rendering and encoding. . . it's really a science.

Eric said...

Hi, my name is Eric Fontaine and I am the Marketing Director at HeyWatch.

It is true that encoding.com is a great service.

But you should have a look at HeyWatch which has been the leader in Online Professional Video Encoding since 2006.

Affordable, with exclusive features such as Watermarking, 2-pass, trendiest video formats (h264, Theora for HTML5), HD Ready, and even more. You can use HeyWatch through a graphical smart and complete interface. But for professional use, you can integrate HeyWatch in white label to externalize your encoding tasks and focus on your core business via a REST API.

Jeff said...

Eric - make it easy for us to switch and improve our service to customers, and we'll do it!

Overman said...

Great move to get experts involved, whichever you settle on. Moviestorm can create such beautiful footage, it will be wonderful to have a site that can showcase beautiful renders.

Richard Grove said...

Oh, man, don't talk to me about codecs. One of the biggest "run and hide int he closet" reactions comes when I start working with codecs. I've read books, articles, bought software and still don't get it. We'll, it's nice to know it isn't just me. Glad you are working to upgrade and hope the tedium doesn't knock you out too much. Good luck!

Matt Kelland said...

The thing I hate most about encoding is that it takes so long to find out when you've got it wrong. Render a movie, upload it, wait for the encode, and then you find out what it's going to look like. This can easily take 24 hours if you've got a longish movie in HD and you're using 2-pass encoding. After the 3rd or 4th attempt, you lose the will to live. And testing it on a short clip is no guarantee how well it'll encode on a longer clip, as codecs are so dependent on keyframes, and exactly what they're encoding: some work fine on slow static shots but are lousy on action sequences where the footage carries very little data from one frame to the next. You can even see this on professional DVDs.