Sunday, February 26, 2006

Exporting Video from Cinelerra for a Video iPod

So. I really, REALLY wanted MPEG-4 output from Cinelerra to go directly into iTunes and my brother's iPod. I had output a test file: (7.8MB)
that loaded and played in iTunes. However, when I went to upload it, iTunes gave me the message:

"Some of the songs in the iTunes music library, including the song "(Video name)",
were not copied to your iPod because they cannot be played on this iPod."

Luckily, Apple provides a feature called "Convert Selection for iPod" when you right-click.
But GEEZ! I already rendered this thing. I've got to do it again? Ugh. OK. And OH NO! The conversion utility takes a RIDICULOUS amount of time! Even on a very fast machine like mine, a 3.2Ghz P4 with 1GB of PC3200 memory, the conversion speed is roughly 1.5 minutes per minute of video. Argh!! That is way TOO slow. But I went ahead and did the conversion with my short test video. On the bright side, once the video was converted, I could then update my iPod and the video was on my iPod. Hooray!!

I continued playing around and loading many different videos into iTunes. In my travels, I stumbled upon one that did not require a conversion. I was shocked! I then reasoned that I'd save a helluva lot of time if I just produced the videos in the format that iTunes expects in the first place. But how to do that? So, my next course of action was to research why that one file worked in iTunes without a conversion and why mine needed the conversion.

To do this, I analyzed the output of MPlayer to determine the differences between files. I learned quite a bit over the past couple of days about audio and video formats by reviewing the output of MPlayer. It helps to have the text of both files displayed in two windows next to each other in order to more easily compare the files line by line. I've done this for you in the image below (click this link with SHIFT-click to open a second browser window):

Reviewing the diffences, I noticed the following:
1) iTunes compatible file had the audio track as the first track in the MOV container, my file had the video as the first track
2) iTunes compatible file was 44.1Khz audio, my file was 48000Khz
3) iTunes compatible file included an extra audio header, my file didn't have the extra header
4) iTunes compatible file audio compression method was MPEG-4, my file was twos complement
5) iTunes compatible file FPS rate was 15, my file was 59.97

After way too many hours of trial and error (and scowls from my girlfriend and dog), I am proud to say that I have found the settings in Cinelerra that will make an MPEG-4 video totally compatible with iTunes so that iTunes does not need to re-render (the "Convert Selection for iPod" feature) the video!

Here are the specs:

For the project:
Set Format
Sample Rate to 44100khz
Number of Channels to two
FPS can be the FPS of your source video
(try lower to 25 or less if problems)
Width 320
Height 240 (320x180 fine as well)
For the render:
MPEG-4 Audio
Bitrate 128000
Quantization of 100
MPEG-4 Video
The rest of the parameters are Cinelerra's
defaults, but I will reiterate here:
Bitrate 7000000
Tolerance 500000
Fixed Quantization selected
Quantization 10
Keyframe Interval 45

I don't care how you do it, but you have to get your videos in that format
because iTunes is COMPLETELY STRICT when it comes to these settings! If you expect your video to upload into iTunes without needing a re-render, you
CANNOT deviate from ANY of these settings!!

Caveat: with the possible exception of the MPEG-4 Video defaults. But I
would only deviate from the settings after you've got the file uploaded into
iTunes without any issues first.

Please let me know how this works for everybody,

Beginner's Guide to Exporting Video from Cinelerra

Update 10/15/2008
Making a Podcast, by Apple

No comments: