Sunday, March 12, 2006

Movie file formats

Movie clips in AVI form tend be unplayable in DVD players even when the play has been multi-regioned. So there needs to be a way to convert these files to MPGs. Googling for AVI to MPG converters gives loads of hits but these hits turn out to be mostly dead-ends. This blog entry is about my discoveries into getting a working AVI to MPG converter. The hits from google tend to be references to shareware for Windoze. I tried one of these in desperation and although it initially seemed to work I later realised that the MPG was truncated to the first hour of the film. It also took AGES to run (I left it converting overnight). I looked for open source solutions and these seem to be very thin on the ground. I came across ffmpeg ( but the last official source release fails to compile with the latest GNU compiler. The latest CVS snapshot also did not work properly when I ran it on Linux. It consumed more and more memory and CPU until eventually all the machine was doing was swapping. I then tried building the last official release on cygwin and amazingly, this works! Not only does it work but the command is quite quick as well. To convert fred.avi to fred.mpg the command to use is: ffmpeg -i fred.avi -target vcd fred.mpg


Andrew Marlow said...

I have moved to Fedora core 5 which comes with GCC 4.1. I tried to build ffmpeg in that environment and found that the official tarballs no longer build due to some problems with assembler that GCC 4.1 catches but earlier versions do not. If, however, you take the latest version from subversion then everything builds and it all works! So I can now convert from AVI to MPG on linux. Hurrah!

Andrew Marlow said...

I have found that it is much more easy and reliable to convert AVIs to MPGs these days and to create DVDs from the MPGs. Although there are some Windoze programs that go straight from AVI to DVD, under Linux it still seems to be necessary to convert the AVI to an MPG as an intermediate step. Here is the command to do it for a film:

ffmpeg -i name of .avi file -target pal-dvd -aspect 16:9 file1.mpg

Now create the DVD file structure with the command:

dvdauthor -o DVD/ -t file1.mpg

followed by:

dvdauthor -o DVD/ -T


mkisofs -dvd-video -v -o DVD.iso DVD

Then burn the ISO image in the usual way.