Adventures in OSS with a Canon HF-10, AVCHD, and Transcoding

We bought a Canon HF-10 video camera in July, mostly to take to E3 to shoot the occasional video. It’s a great camera – small, light, easy to use, nice build quality, SDHC cards, etc.

The software that comes with it – something called ImageMixer 3 SE – is surprisingly not sucky. I mean, it still sucks in the sense that almost all OEM software does, but I was impressed that it supported three export types (DVD-quality MPEG2, iPod-quality h264 MP4, and Youtube). Unfortunately since installing the software my laptop is prone to bluescreen, but I guess that happens.

Sadly, those export options aren’t enough for me – I want more control over the formats.

So, that created the still-ongoing saga of trying to find an path to convert the camera’s native .M2TS or .MTS files into any random format (preferably h264 MPEG-4 for use in a Flash video player) – using open source software.


The first thing I tried was MediaCoder, which I’ve had some success with in the past. It’s under active development by a dude in China and is relatively reliable, updated frequently with the latest versions of things like ffmpeg and x264 – so it can generally read just about anything.

I was further stoked when I read on their blog that it had AVCHD support in a recent update. Unfortunately, try as a I might, I couldn’t get it working (along with just about everyone else). You can read about some of the saga here, but the short version is I could only get it working after reading some random post on the forums with some information about specific settings.

I’ve compiled those settings into a sort-of-working MediaCoder preset profile, which you can download here:

* Download HF-10/AVCHD MediaCoder preset

Note, however, that it doesn’t work reliably for me. The longer the file the more likely it is to fail, crashing randomly at some point in the file. For short files though, it seems to work fine. I’ve posted about this on the forum.

Other OSS software:

I tried just about everything else I could find in various combinations. The only thing that came close to working was installing a recent version of ffdshow-tryout and using AviSynth and VirtualDub to read via a simple DirectShowSource script – but ffdshow looks like it still isn’t reading the AVCHD format 100% cleanly; there were a lot of visual artifacts – not enough to totally ruin it but enough to make me not want to use it.

Basically everything else I tried was the same as MediaCoder – using some variant/combination of ffmpeg, x264, mplayer, mencoder – all came close but didn’t cut the mustard.

The (sadly closed source) solution

In the end I just shelled out for a copy of the CoreAVC Professional Edition. Installed that, fired up VirtualDub and AviSynth and (using DirectShowSource again) had it working perfectly. In about 10 minutes I had a beautiful looking HD xvid encoded that made the previous weeks of effort looking for an open source solution completely wasted.

The verdict

I’m by no means a video expert, so I might have missed something. I think I know more than the average bear though, so I figure if I can’t get it working, most people aren’t going to have much of a shot.

I was about to give up and buy Nero Vision, which I think is one of the few commercial products that a) doesn’t COMPLETELY suck, b) isn’t ridiculously priced, and c) actually fucking works, but the CoreAVC option integrates happily and more effectively with the rest of my OSS tools, so I think that’ll be what I do for a while.

If you’re trying to do something similar with OSS tools, I’d give up for now and drop the ~US$15 on CoreAVC and use VirtualDub and/or other solutions that can read from a DirectShow source.

I’ll be keeping an eye on it; I’m sure it’s only a matter of time before MediaCoder (or its dependent components) are updated to work effectively.

Sun Creating an Open Video Codec?

Sun are reportedly working on a new open source, royalty free codec for video.

Detailed at the Sun Labs Open House event in Menlo Park, Calif., the project is called Open Media Stack or the Open Media System. It was derived out of Sun’s Open Media Commons initiative for development of royalty-free and open solutions for digital content.

No timeframe has been announced, and the article makes some mention that it is based on “H.26x technology”.

If true, this is great news – under the condition that it is truly open. There are a few problems with the current major video codecs – most notably that they’re tied up heavily with patents. So heavily, in fact, that it will be interesting to see how they’re going to go about this without getting smashed at some point with a patent infringing suit, given how much revenue is derived from licensing of these video patent portfolios.

A lot of fuss is made about codecs like Xvid and H.264 because they’re “open”. This is a common misconception – they’re not open, they just have open source implementations. To actually use these codecs commercially (for example, building a hardware device that can play them) requires paying licensing fees (usually to the MPEG Licensing Authority, who collects the fees and pays royalties for most of the video codec-related patents).

So, a truly open video codec will certainly shake things up a bit, perhaps freeing the world from the clutches of those few companies that own the video market (two of the major codecs in use on the web today – On2 and h264, both used in Flash videos like you get on YouTube, are protected heavily by patents and require significant licensing fees to do anything with them), providing more choice and more freedom for users.

It should also be noted that the BBC tried (or are trying) a similar thing with their Dirac codec, but it never gained traction – presumably because of the availability of other “free” high quality codecs like Xvid.