Canon Movies, DIVX and Linux


This page is about how to turn raw Canon .AVI files into DIVX movies. The information was provided by Ben Low, and I haven't tested it yet, so you'd be best addressing queries to him.

Another page describes how to convert the .AVI files into MPEG1 movies if you'd rather do that, but this method is simpler.

For how to get your Linux machine to talk to your Canon A40 see my Howto page, and there are also some FAQs.

Ben Edgington,
7 May 2003

Home


Introduction

I recently bought a Canon S45, and like you wanted to put the few movies I've taken up on the web. I have found a slightly different approach which you might like to try - encoding to divx rather than mpeg, crunching the audio slightly, and all using fewer tools :-).

Also, I found the divx players (linux and windows) handle the raw frame rate fine so there's no need to convert.

The lavc mpeg4(divx) codec seems slightly better quality than the divx one! I tried using the aac audio codec, but mencoder whined about it.

About the only drawback is that until divx gets a little more widespread, viewers need to explicitly fetch the divx codec for windows (media player), from divx.com.

Method

With lame installed it is possible to encode completely via mencoder, since Windows Media Player supports MP3.

Note that mplayer's -include option can be used to read a per-movie config file to specify rotations, etc. And it works!

$ vi MVI.AVI.conf   # vop rotate=1  (to rotate the movie if required)
$ rm -f divx2pass.log

$ for p in 1 2; do
  mencoder MVI.AVI -include MVI.AVI.conf \
    -channels 1 -srate 11025 -oac mp3lame -lameopts mode=3:abr:br=16 \
    -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=496:vpass=$p -o mvi.avi
  done

Sample images

About 18 seconds.

http://bdlow.net/MVI_0159.AVI                  [5.9MB]
http://bdlow.net/MVI_0159.AVI-512k.avi         [812KB]
http://bdlow.net/MVI_0159.AVI-140k.avi         [504KB]

I'm pretty impressed at the quality - the video rate is approaching that of the audio!

MPlayer is a neat piece of software :-)

PCM audio

In the event that you are happy only to view the movies with Windows Media Player and not the DivX player then you can use PCM encoding for the audio. I found the DivX player barfed on the PCM audio, WMP works fine. This doesn't require lame.

The process is much the same: pull the audio, convert the audio and compress the video + audio. Here's the relevant part of my batch conversion script:

  mplayer "$f" -vo null -ao pcm -aofile "$tmp/$f.pcm"       && \
  sox "$tmp/$f.pcm" -r 5512 -c 1 "$tmp/$f.wav"              && \
  mencoder "$f" -oac copy -audiofile "$tmp/$f.wav" \
      -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$bitrate \
      -o "$o-${bitrate}k.avi"