DivX Editing

From AMV Wiki, a wiki about anime music videos.

Contents

Problems caused by editing Divx files

DivX, XviD, or other codecs (somewhat erroneously) known as "MPEG-4" generally should not be used in an editing program. These formats are designed for distributing video, and NOT for editing it.

Why Not?

Here is a list of common problems that can be caused by using such video in an editing program:

  • Slow seeking and decoding of frames.
  • Edits not being frame-accurate.
  • Frequent crashing of the editing program.
  • Frames being displayed out of order.
  • Smearing, blocking, and other types of video artifacts.
  • Editing program giving an error or displaying black video.

Technical details

There are two types of video codecs. Inter-frame codecs, and Intra-frame codecs. DivX and these other codecs are Inter-frame codecs, which means that some frames may depend on the content of other frames to be completely decoded. These codecs often store 3 different types of frames: I-frames, P-frames, and B-frames. Intra-frame codecs, on the other hand, usually use only I-frames.

Common frame types

I-frames, commonly called keyframes, store the entire image. Intra-frame codecs use I-frames exclusively. Every frame is encoded individually, and can be decoded individually. Inter-frame codecs on the other hand, use very few I-frames. The reason for this is that I-frames can take a large amount of space to store, and codecs like Divx are designed to compress the video as small as possible.

P-frames, or delta frames, store only the changes from the last frame. This allows them to be much smaller in size than I-frames. The tradeoff though, is that in order to decode, or view, a P-frame, the computer must go back to the last I-frame, and decode every single frame up until the current P-frame. A Divx compressed video can sometimes go about 300 frames before inserting a new I-frame. This means that to decode the last frame in the sequence, It has to skip back to the previous I-frame and then decode all 300 frames up to the current P-frame that you want to view!

B-frames, or bi-directional frames, work like P-frames, but instead of just saving the changes from the previous frame, they also take the next frame into account! For an editing program that's not capable of dealing with these types of frames, it can end up displaying the frames out of order!

What Can I Use?

If you have video in an Inter-frame codec that you would like to edit, then you need to convert it to an Intra-frame codec first.

Here are some common video formats that you should NOT edit with:

  • XviD, DivX (i.e. H.263 implementations)
  • x264, Ateme's H.264 implementation, Nero Recode, other H.264 implementations
  • WMV
  • RealVideo
  • Sorenson Vision (commonly used in Quicktime containers)

Here are some formats which are fine to edit with:

  • Uncompressed (file sizes can be very large, though)
  • Huffyuv (smaller than uncompressed, but still huge)
  • Lagarith (smaller still than HuffYUV, but is slower)
  • DV (this format will introduce some slight quality loss into your video, and also has some restrictions on resolution and framerate)
  • M-JPEG (depending on the quality level you set, it can be large, and can introduce slight to significant quality loss, however it is very fast)
  • AVISynth (doesn't involve making a large file, but can be slow and is not supported well by all editing software)

What To Do?

If you have some video in a format that is not usable, you can usually make it usable by converting it to one of the formats listed above. Depending on the format that your source video is in, there are a number of ways of doing this.

Easy Way

The commercial program eovideo is a great way to convert files to another format without having to go through a lot of technical work. The main drawbacks to this program are that after a 30-day trial, you must purchase the program in order to continue using it, and it doesnt offer the same amount of flexibility of other methods.

More Complex Way

If your video is in AVI format, and you have the appropriate Video for Windows codec (true if you can open the file in VirtualDub without error), you can serve it via an AVISynth script with the following line:

AVISource("C:\mypath\myvideo.avi")

(replacing the path and filename as appropriate, of course).

If the file is not an AVI file, or if the above line doesn't work, then you can try the following line:

DirectShowSource("C:\mypath\myvideo.avi")

Once you have the file loaded through AVISynth, you can either load it directly into your editing program (if it supports AVISynth scripts), or you can load it into VirtualDub where you can encode it into another codec such as Huffyuv or Lagarith.