Technique

Datamoshing: How to Glitch Video (Avidemux & FFmpeg)

Datamoshing Example

Datamoshing is a glitch video technique that exploits how video compression works. By removing or manipulating the structural frames that codecs depend on, you force the decoder to apply motion from one shot onto the pixels of another — producing smeared, melting, blooming transitions that have become one of the most recognizable effects in glitch art.

The technique sits at the intersection of technical knowledge and creative experimentation. Unlike filter-based effects that simulate corruption, datamoshing creates actual broken video files, which is what gives it that raw, unpredictable quality no plugin can fully replicate.


How Video Compression Works (And Why Datamoshing Breaks It)

Video Compression Visualization

To understand datamoshing, you need to understand how video codecs store information. Uncompressed video would require enormous file sizes — a single minute of 1080p footage at 30fps would be roughly 10 GB. Codecs like H.264, H.265, and MPEG-4 ASP (Xvid) solve this by being selective about what they store.

Frame Types

Video codecs organize footage into a GOP (Group of Pictures) structure using three frame types:

  • I-frames (Intra frames) — Complete, self-contained images. Think of these as full photographs. They serve as reference points that the decoder can display without any other information. A GOP always starts with an I-frame.

  • P-frames (Predicted frames) — Store only the differences from the previous frame. Instead of saving a complete image, they record motion vectors (“this block of pixels moved 3 pixels right and 2 pixels down”) and residual data (color corrections). P-frames are much smaller than I-frames.

  • B-frames (Bidirectional frames) — Reference both previous and future frames. They offer the best compression but add complexity. Most datamoshing workflows avoid B-frames for simplicity.

What Happens When You Remove an I-Frame

When the decoder hits a P-frame, it looks backward for a reference image to apply motion data to. Normally that reference is the preceding I-frame. If you delete that I-frame, the decoder can’t find a clean reference — so it grabs whatever pixel data is still in its buffer from the previous shot.

The result: motion vectors from shot B get applied to the image of shot A. Faces melt into landscapes. Colors smear across the frame. The codec is doing exactly what it’s supposed to do — applying motion prediction — but to the wrong source image.

This is why datamoshing produces such distinctive, fluid effects. The artifacts aren’t random noise — they’re the codec’s motion-estimation algorithm made visible, operating on mismatched data.


Core Datamoshing Techniques

I-Frame Removal (The “Melt”)

Datamosh Transition

This is the signature datamosh effect — two shots flowing into each other through a smeared, painterly transition.

How it works:

  1. Join two clips into a single file with a hard cut between them.
  2. Compress with MPEG-4 ASP (Xvid) codec, setting a very high maximum I-frame interval (e.g., 9999) so the encoder places as few I-frames as possible.
  3. Open the compressed file in a frame editor like Avidemux.
  4. Navigate to the I-frame at the cut point between your two shots.
  5. Delete that I-frame, accepting any corruption warnings.
  6. Save with video output set to Copy (no re-encoding).

The decoder now has no clean reference for where shot B begins, so it keeps applying shot B’s motion data to shot A’s pixels. The effect persists until the next I-frame restores a clean image.

Controlling the melt duration: The smear continues until the decoder hits another I-frame. If your GOP interval is very long, the melt lasts longer. For shorter melts, ensure an I-frame appears sooner after your deletion point. You can manually place I-frames by splitting your encode into segments.

P-Frame Duplication (The “Bloom”)

P-frame bloom creates hypnotic, pulsating motion trails by repeating a single frame’s motion data over and over.

How it works:

  1. Compress your clip with Xvid using a long GOP interval.
  2. In Avidemux, find a P-frame with strong motion — quick camera movement, fast-moving subjects, or dramatic zooms work best.
  3. Select that P-frame and duplicate it 20–50 times.
  4. Save with video output set to Copy.

Each duplicated P-frame re-applies the same motion vectors, causing pixels to streak, bloom, and trail across the frame. Subtle movements create gentle, dreamy drifts; aggressive motion produces explosive, psychedelic bursts.

Bloom vs. melt: I-frame removal creates transitions between shots. P-frame duplication creates effects within a single shot. Many datamosh pieces combine both — melting between scenes, then blooming within key moments.

Hybrid Techniques

Advanced datamoshers combine frame manipulation in more complex ways:

  • Chained melts — Remove multiple I-frames across several cuts, letting the mosh cascade through three or more shots
  • Selective bloom bursts — Insert short bloom sequences (5–10 duplicated P-frames) as rhythmic punctuation within otherwise clean footage
  • Reverse moshing — Reverse the clip before moshing, then reverse the output, creating motion trails that flow “backward”
  • Multi-pass corruption — Mosh a clip, re-encode it, then mosh it again for deeper, more layered degradation

Step-by-Step Workflows

Method 1: Avidemux (Beginner-Friendly)

Avidemux Workflow

Avidemux is the most accessible entry point for datamoshing. It’s free, cross-platform, and has a visual frame-by-frame navigator.

Setup:

  1. Download Avidemux (available for Windows, macOS, Linux).
  2. Prepare your source footage — export from your NLE as a high-quality intermediate (ProRes, DNxHR, or high-bitrate H.264).

Encoding for moshing:

  1. Open your source file in Avidemux.
  2. Set Video Output to MPEG-4 ASP (Xvid4).
  3. Click Configure next to the video codec.
  4. Under the Motion & Misc tab, set Max I-frame interval to the highest value possible (fill the field with 9s).
  5. Set a reasonable bitrate (3000–8000 kbps depending on resolution).
  6. Set Audio Output to Copy (or your preferred audio codec).
  7. Set Output Format to AVI Muxer.
  8. Save the file. This is your “moshing copy.”

Moshing:

  1. Open the newly encoded AVI file.
  2. Set Video Output to Copy (critical — you don’t want to re-encode).
  3. Use the frame navigation (arrow keys or the slider) to find I-frames. In Avidemux, I-frames appear as clean, sharp images after a series of increasingly degraded P-frames.
  4. To melt: Select the I-frame at a scene transition and delete it (Edit > Delete or Cut).
  5. To bloom: Select a P-frame with strong motion, copy it (Edit > Copy), then paste it multiple times (Edit > Paste, repeated 20–50 times).
  6. Set Output Format to AVI Muxer and save.

Tip: Avidemux can crash when pasting many frames. Save your work frequently and paste in batches of 10.

Method 2: FFmpeg (Command Line)

FFmpeg gives you precise control over GOP structure and frame manipulation. It’s faster for batch workflows and scriptable for repeatable results.

Encoding with controlled GOP:

ffmpeg -i input.mp4 -c:v mpeg4 -vtag xvid -qscale:v 4 -g 9999 -bf 0 -an output.avi

Flags explained:

  • -c:v mpeg4 -vtag xvid — Use MPEG-4 ASP codec with Xvid tag
  • -qscale:v 4 — Quality level (lower = higher quality, 2–6 is useful range)
  • -g 9999 — Maximum GOP size (minimizes I-frames)
  • -bf 0 — Disable B-frames (simplifies frame structure)
  • -an — Strip audio (add it back later)

Inspecting frame types:

ffprobe -show_frames -select_streams v input.avi | grep "pict_type"

This lists every frame’s type (I, P, or B), helping you identify exactly where to make cuts.

Extracting individual frames for manual editing:

ffmpeg -i input.avi -vf "select=eq(pict_type\,I)" -vsync vfr i_frames_%04d.png

This extracts only I-frames as numbered PNG files, useful for understanding your clip’s GOP structure.

Method 3: FFGlitch (Purpose-Built)

FFGlitch is a command-line tool specifically designed for datamoshing and video glitch art. It provides direct access to motion vectors, quantization parameters, and frame data that general-purpose tools abstract away.

FFGlitch works by applying JavaScript functions to video frame data during the decode/encode process. This allows granular control — you can modify individual motion vectors, shift them by custom amounts, or apply mathematical transformations to create effects impossible with simple frame deletion.

Method 4: Faking It in NLEs

Pseudo-Datamosh in After Effects

After Effects, Premiere Pro, and DaVinci Resolve can approximate datamoshing using displacement maps, time-remapping, and blending modes. The results are more controllable but lack the authentic unpredictability of real codec manipulation.

Common NLE pseudo-datamosh approach:

  1. Freeze the last frame of clip A.
  2. Apply a Displacement Map effect using clip B’s motion as the displacement source.
  3. Animate the blend from the displaced freeze frame to clip B.
  4. Add RGB separation, noise, and compression artifacts as overlays.

This works well for commercial projects where predictability matters, but for genuine glitch art, real datamoshing is the standard.


Troubleshooting Common Problems

”My moshed video just shows a black or green frame”

The decoder couldn’t find any reference data. This usually means you deleted too many frames or the file structure is too damaged. Fix: Re-encode and delete fewer I-frames. Make sure you’re only removing I-frames at scene transitions, not structural I-frames the decoder needs to initialize.

”The melt effect only lasts one frame”

An I-frame appears immediately after your deletion point, resetting the image. Fix: Re-encode with a higher maximum I-frame interval, or delete additional I-frames further into the sequence.

”Avidemux crashes when I paste P-frames”

Avidemux struggles with large paste operations. Fix: Paste in batches of 5–10 frames, saving between each batch. Alternatively, use FFmpeg or FFGlitch for bloom effects.

”The output file won’t play in my media player”

Moshed AVI files use non-standard codec behavior. VLC handles them best. Fix: Play the file in VLC, or screen-record the VLC playback if you need a clean export for editing.

”The effect looks different every time I play it”

Some players handle corrupted streams differently, and seeking within the file can produce different decoder states. Fix: Screen-capture the playback you like, or use FFmpeg to re-encode the moshed output into a clean H.264 file: ffmpeg -i moshed.avi -c:v libx264 -crf 18 final.mp4

”My audio is out of sync after moshing”

Adding or removing frames changes the video duration without adjusting the audio timeline. Fix: Strip audio before moshing (-an flag in FFmpeg), then re-sync in your NLE by aligning to visual cues.


Choosing the Right Source Footage

Source Footage for Datamoshing

Not all footage moshes well. The quality of your source material dramatically affects the final result.

Footage that moshes well:

  • High-contrast subjects — Bold colors, strong edges, and clear shapes produce more visible motion vector artifacts
  • Fast, directional motion — Camera pans, zooms, and quick subject movement create dramatic P-frame data
  • Scene transitions with contrasting content — A face melting into a landscape reads better than two similar indoor shots
  • Clean, sharp originals — Pre-existing compression artifacts compete with your intentional glitching

Footage that moshes poorly:

  • Static shots — Little motion means little P-frame data to exploit
  • Already heavily compressed video — Low-bitrate sources have weak motion vectors and blocky artifacts that muddy the effect
  • Very dark or very bright footage — Low-contrast scenes produce subtle, hard-to-read mosh effects
  • Footage with uniform color — Blue sky, white walls, and solid backgrounds give the codec nothing interesting to mispredict

Resolution considerations: 720p and 1080p are the sweet spot. 4K files produce high-quality moshes but are much slower to process. Extremely low-resolution footage (360p and below) moshes quickly but produces blocky, less visually interesting results.


Datamoshing in Culture

Datamosh Art

Datamoshing entered mainstream visibility through music videos and became one of the most recognized glitch art techniques worldwide.

Kanye West — “Welcome to Heartbreak” (2009) directed by Nabil Elderkin, is the most cited example. The video features faces and bodies melting into each other through I-frame removal, introducing millions of viewers to the aesthetic. The effect was achieved by datamoshing the raw footage, not through After Effects simulation.

Chairlift — “Evident Utensil” (2008) was actually one of the first major music videos to feature datamoshing, directed by Ray Tintori. The video won a YouTube award for Most Creative Video and helped establish datamoshing as a recognized artistic technique.

The technique has since appeared in videos for A$AP Mob, Yung Lean, and numerous electronic music artists. It’s become a visual shorthand for digital psychedelia and technological disruption.

Beyond music videos, datamoshing appears in gallery installations, VJ performances, and social media content. The aesthetic has been referenced in mainstream advertising and graphic design, though often through simulated effects rather than genuine codec manipulation.


Creative Directions

Abstract Datamosh Art

Datamoshing is more than a technical trick — it’s a way of making video compression visible as material. The artifacts you create aren’t random; they’re the codec’s prediction algorithm operating on mismatched data, revealing the mathematical models that normally remain hidden behind seamless playback.

Narrative datamoshing uses the melt transition to suggest connections between subjects. A person’s face dissolving into a cityscape implies something about identity and environment. The technique carries inherent metaphorical weight — transformation, impermanence, the instability of digital identity.

Rhythmic datamoshing syncs bloom effects and melt transitions to music, creating audio-reactive pieces where the visual corruption pulses with the beat. See our guide on audio-reactive glitch visuals for techniques.

Layered approaches combine datamoshing with other glitch techniques for richer results: