Friday, September 9, 2011

Converting a QuickTime .mov (ProRes codec) to a Windows AVI

On the phone last month to our video production agency, I told them I could work with any video format. Yesterday I was afraid they had proved me wrong.

They sent me a QuickTime .mov encoded with the ProRes codec. This was their source format, and the goal was to ensure no loss of quality on their side, so this wasn't just some crazy attempt on their part to trip me up :-). In any case, I figured any standard video converter (like AVC) could handle this, but nothing I tried worked. I then remembered the amazing FFMPEG from my DVR-building days, and was sure this could easily do the conversion if I could just figure out the correct command-line args. Still no luck. I kept getting the error, "swScalar: Unknown format is not supported as input pixel format". Some searching provided some clues that this was due to mapping, so based on a forum post suggestion, I tried adding the flags, "-map 0:0 -map 0:1". I then got a "codec type mismatch error". I installed the ProRes QuickTime decoder, but this didn't help either.

Finally, I happened upon the following solution:

- install AviSynth (http://avisynth.org/mediawiki/Main_Page)
- add the QTSource dll to AviSynths "plugins" directory (http://www.tateu.net/software/dl.php?f=QTSource)
- install VirtualDub (http://www.virtualdub.org/)

Then you just need to write an AviSynth script in the same directory as the video file and name it with an ".avs" extension:
QTInput("C:\test.mov", audio=1)
BicubicResize(720,486,0.1,1.00).AssumeFPS(29.97)

(BTW, the documentation for QTSource says to use audio=true, but AviSynth was having none of that.)

- open the .avs file as if it was a video in VirtualDub
- save as .avi

Whew. I was about five minutes away from admitting defeat and asking them for a different format. Aside from bruising my ego a bit, this would have wasted at least another day or two that I didn't have to spare.