How to create compression artifacts [ Datamoshing ]
by mr datamosher
Vectorpunk [is also over according to mr O'Reilly]
[rest of this post is written with info I got from George Gardiner]
Although I just learned that Datamoshing is over, I want to quickly describe how you can make it happen, to late. So here we go,
When a video is encoded, each frame is stored as an I frame or a P/B frame. An I frame [Sven Konig calls them ∆-frames] is like a JPEG image, it holds the still image (that frame) in its entirety. P and B frames are the smart frames that allow videos to be compressed. They store only the differences between the current frame and the last frame. The effect you see in the datamosh videos is what happens when you store only the differences between frames, ie. when there are no I-Frame references.
Here is how you can do it the hardcore way:
1. Get your video in MPEG4 format, XViD or DIVX is fine.
2. Save it as an AVI file
3. Download a HEX editor and open the AVI file with it. (http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm is good, and free) You'll see a lot of numbers and symbols. This is the raw video data.
Each video frame in the AVI file will start with the code 00dc, you can search for these in the file (there will be a lot!). About 1 in 25 of these will be an I-Frame (though this depends on things like what quality you saved it at, etc). An I-Frame can be identified by the HEX string 00 01 B0 01 that will appear about 5 bytes after the 00dc frame start marker.
4. These are the frames you need to nuke. I think you can just hold delete until all the data is gone, and the next 00dc, or 00wb moves into its place.
1. NOT ALL VIDEO PLAYERS WILL LIKE YOU DOING THIS! It is a hack afterall, what you're really doing is breaking the video. After removing the I-Frames with this technique, the first thing you should do is use something like VLC to convert it back into an un-broken format. When you do this the visual effect you created by removing the I-Frames will be preserved, but VLC will insert new I-Frames so that all video players understand how to play it back (some throw a fit when they do not find the data they expect, others like VLC will carry on regardless). This is very important if you want to then upload to YouTube as it will probably not accept a broken video.
2. Should go without saying, but keep a backup of your original video before you start.
3. As you are removing video frames, you'll also loose audio sync over time. Best thing to do is probably put the audio on after you've finished.
4. You may get some interesting effects by keeping some I-Frames, eg. syncing the frames you keep to a beat or something?
[[edit"" this following method does no longer seem to work, probably because of a new version -> the youtube way does still work so try this instead!]]
Here is how you can do it the less hardcore way:
Use the program called VirtualDub. You need to use MPEG4, (DivX or XViD).
VirtualDub allows frame-by-frame direct editing, which allows you to delete the I-Frames (note: VirtualDub calls them Key Frames). As long as keyframe reconstruction is turned off you will produce the same effect with no nasty hex editing required. [[edit"" this method does no longer seem to work, probably because of a new version -> the youtube way does still work so try this instead!]]
There should be other ways that are even more easy (or hard), but these are the cool ways! Oh no, its over. We need something !