Archive for December 11th, 2009

Editing Kodak digicam video files on a PC

I have a bunch of Kodak HD digicams lying around (they cost just $100-$150 these days), but I don’t really use them because they are so slow to edit. You see, on the PC side, editors use the Quicktime engine to decode the MPEG4-SP format. On the Mac side these files are re-encoded during import to a friendlier format, so it’s not a big deal there, but on the PC side it is, since Quicktime for the PC is very slow. Not only that, but under Sony Vegas, using these MPEG4-SP MOV files via the Quicktime decoder is crashy.

So obviously, I needed a way to losslessly re-wrap (NOT re-encode) these MOV files to AVI, in order to force a more sane decoder to take over the decoding job under Vegas. So today I found a way to make these 720/30p HD files REAL TIME on my 5 year old Pentium4 3Ghz PC under Sony Vegas. From 2 fps previewing speed when using Quicktime under Vegas, to full 30 fps when using ffdshow instead! And it’s mighty stable! Here’s how:


Main method

1. Download ffdshow. Use the latest CLSid version for your operating system. Here’s the current 32bit version (as of this writing), if you are lost and you don’t know which one to download. Install it.

2. Download and install SUPER (use the RO server, the US one is corrupted). Load the app, right click, and set “Output file management” to any newly created folder (this will be the folder that will hold all your AVI files). For example, e.g. C:\myvideos\holidays\france\

3. Create another folder in that folder, call it “originals” (so now it becomes something like C:\myvideos\holidays\france\originals\). Copy the Kodak .mov files from the SD card to that “originals” folder.

4. Navigate to the “originals” folder with Windows Explorer, and drag-n-drop all the MOV files to SUPER. Set up SUPER exactly as shown below in pink, and press “encode active files”.

Click for a larger view

Update: If the created MJPEG AVI files are reported as 600 fps by your player/editor, then use MEncoder instead of FFmpeg in the above screenshot.

Now, transcoding will commence. Transcoding to AVI will be really fast, since we only re-encode the audio (Vegas can’t decode the original ulaw audio format without Quicktime you see, and these AVI files don’t use Quicktime). Also, this conversion is completely LOSSLESS, you won’t lose quality at all by doing so.

5. Load Sony Vegas (or any other PC video editor that uses the “Video for Windows” technology), and load the newly-created AVI files in it (not the MOV files). Load the Vegas “project properties” dialog, and manually set resolution to 1280×720, frame rate at 29.97, field order to “none/progressive”, quality to “best”, de-interlacing to “none”. In the “audio” tab, change the audio resampling & stretching to “best”. Leave any other fields found in that dialog as is. Click “ok”.

6. Now edit (previewing is going to be stable and faaaaast when using the default preview/auto mode). When you are done with editing, you MUST select ALL clips in the timeline (either by using the “edit mode”, or by using the SHIFT key), and right click on them, select “switches” and then “disable resample”. This is very improtant because otherwise you will get a “ghost” image out of these clips (because these stupid Kodak cameras don’t record in a fixed frame rate). When done, export for PC viewing or Youtube/Vimeo/PS3/XBoX360 like this under Vegas. For other video editors look here.


Alternative method

Windows 7 has problems with SUPER. Also, some people just hate it, or don’t trust it. So, here’s the command line edition of the same workflow shown above. It requires some small knowledge of MS-DOS usage.

1. Follow #1 from the first method.

2. Download the latest build of ffmpeg. Create a folder called “ffmpeg” somewhere, and unzip the contents in there.

3. Inside that same ffmpeg folder, create another folder, called “videos”.

4. Copy the Kodak .mov files from the SD card on the ffmpeg/videos/ folder.

5. Open a DOS prompt, navigate to the ffmpeg/video/ folder, and run the following command for each and every one of your MOV files:
..\bin\ffmpeg.exe -i kodak_001.mov -f avi -vcodec copy -acodec pcm_s16le kodak_001.avi

Substitute the “kodak_001” file names with your video file names. E.g. the 100_132.mov will become 100_132.avi, etc. You will have to manually do that for every one of your files, unless you are proficient with MS-DOS scripting/programming, in which case you can automate it using “batch” files. If you don’t know what I’m talking about scripting here, just do the job manually. Here’s a batch file you can run though, save it on notepad, name it thejob.bat, save it on the ffmpeg/bin/ folder, and drag .mov MJPEG files into its icon (script by Michael Burgess):

echo off
echo hello
IF EXIST %1 GOTO THEJOB

ECHO No Job
PAUSE
GOTO JOBDONE

:THEJOB
ffmpeg.exe -i %1 -f avi -vcodec copy -acodec pcm_s16le %1.COPY.avi

IF ERRORLEVEL 1 ECHO. Error 1
IF NOT ERRORLEVEL 1 ECHO. No Error
PAUSE

:JOBDONE
EXIT

Transcoding to AVI will be really fast, since we only re-encode the audio (Vegas can’t decode the original ulaw audio format without Quicktime you see, and these AVI files don’t use Quicktime). Also, this conversion is completely LOSSLESS, you won’t lose quality at all by doing so.

6. After the conversion to AVI is done for all files, move all these newly-created AVI files in another location, e.g. where you usually store your video projects (e.g. C:\myvideos\holidays\france\ whatever).

7. Follow #5 and #6 from the first method. Read the important notes. You’re done.


Tutorial for MJPEG MOV files

IF you’re having speed/stability issues with HD MJPEG MOV digicams too (e.g. Panasonic LX3, Nikon D90, and many other digicams), you can apply this tutorial too to create AVI MJPEG streams. This would result in previewing these files twice faster. You need to do two changes to the tutorials above:

1. After installing ffdshow in step #1, load ffdshow’s “VfW Configuration” panel, click the “Decoders” tab, click “Codecs”, scroll down to find the MJPEG format, and change it from “disabled” to “libavcodec”. Screenshot.

2. When you set the frame rate on your Vegas or other PC video editor’s project properties dialog (just before you edit), you must figure out what is the source’s footage frame rate. Vegas tells you what the original is if you select it in the Project Media tab, and read its status bar. It will say something like “30.000 fps”, or “24.000 fps”. Type in the frame-rate field that number. Set up the rest of the project properties as shown in the tutorials above. At the very end of editing, after you “disable resample”, export at 29.97 fps if the original reported frame rate was 30, or at 23.976 if the original was 24. Leave at 25 if it the original was 25. This will ensure sane, standard-compliant, frame rates.

Everything else is the same as in the tutorials above.


Important notes

1. While editing, the gamma will be different than the original Kodak MOV files. This is normal. Quicktime has a known problem with MPEG4 footage, rendering them with a lower gamma value (looking washed-out). What you will get with AVI and Vegas, is how the camera REALLY recorded the footage — which is a good thing.

2. This method only offers speed and stability under PC editors for MPEG4-SP & MJPEG files, not for MPEG4-AVC/h.264 files. Please note that the Kodak digirecorders, like the Zi6/Zi8/Zx1 are h.264-based, not MPEG4-SP based like their actual Kodak HD digicams. Therefore, for these Z-series digirecorders you’ll need something like Cineform NeoSCENE (costs $99) to go around the editing problem.

3. SUPER might trigger your anti-virus. This doesn’t mean it has a virus or that it’s malware, it’s just that it doesn’t always play nice with some anti-virus apps.

4. Vegas Platinum 10 has a bug with the ffdshow MJPEG decoder, so you might see slowness when that version is used. Previous versions of Vegas don’t have the bug. I don’t know about newer, or Vegas Pro 10.