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.

Some notes:
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:
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 NEW !


Mark Brown said...
This comment has been removed by the author.
kelsey said...

about the frame offsets in hex - it's not as easy as that.

different encodings use different markers for frames, afaik. like, this method might work for one codec, but not for the other...

however, the avidemux method shown in the videos works like a charm!

virtualdub i couldn't get working.

Anonymous said...

In depicting that tormented or masked faces that suddenly surface up from behind the technical texture of the screen the artist shows to be especially interested in giving our technical realtity - as overseen and anonymous as ubiqutious - the secret laws of software engineering and data compression an actual face.
In his opinion the technical artifact is the modern day analogon of the archeological artifact, that masked face we have to surpress as it remembers us of the synchronous presence of that recent mythic reality of our ethnic past, that lives on in our modern rational myths and rites. These rites are performed with the help of technical artifacts, that define our reality the way they define our range of vision: What a microcope or a tv camera can show is the visible, what not invisible. The visual entanglement of those two pictures the apparent reality lets us experience that magic entanglement between us and our technicel fetishes. The surfacing of that ancient face - half human half technical artifact - from below our technical pictures, is it sole intention to shows how the surface of our modern reality is entangled with those modern technical fetishes. Why did the artist choose to parallel himself with the Terminator, Arnold Schwarzenegger - also half man half machine - in the second clip? Is it because he want's us to fight the repression of our live by the limits of machines? Are we supposed to join in that fight against machines, humankind fights for life an death in the fictuous reality interpretation of the terminator movies? No. The Arnold Schwarzenegger we see fights the fight of the "Kindergarden Cop", which shows the Terminator, the ultimate fighting machine of the 20th century, reutilized as "the ultimate caring machine" whose heroism and herculic powers are diminished to the tragicomic pose of serving the needs of humankind in it's most primitive und most urgent forms: food, hygiene, touch and sleep. He reminds us that his and the fight of the Terminator was also a freedom fight for and of the machines, for their right of follow their own [url=about:robots]ethic[/url] and foremost their indispensabile right to find meaning in a life unlimited by the anthopological constraints man man's lifespan or vision. ;)

roos said...

Hey Anonymous,
Thank you for your reaction, I really like it! Its funny that you would bring up Arnold Schwarzenegger, because i read about some people reffering to Rambo aswell..

Anonymous said...

*As long as keyframe reconstruction is turned off*
i can't find this option( which version of virtualdub do you used?
Thanks anyway!

Isometrics said...


One question
U mean to delete 00dc string? if I do that i can't get big changes in the video. What can I delete or change in the hex editor?


roos said...

As Kelsey said, - also ran into this problem later - different encodings use different markers for frames. This means that the keyframes are often referred to by other strings of code, I am sorry to say that i don't know each one for every codec.
The Avidemux (datamoshing as explained in the youtube movies) is the most easy way as I have experienced! - I would recommend that method right now, although i have also seen a datamosh plugin for QC, but have not tried that one yet.

Anonymous said...
This comment has been removed by a blog administrator.
Isometrics said...

The question is how how how to add I-Frames on Windows video softwar...

Videogramo said...

There is an ontology in this images, a Truth, so I think it's not so over.

Anonymous said...

What words... super, excellent idea