Monday, January 07, 2013

summoning ghost frames

this is a write-up of the ghost frames workshop i delivered at GLI.TC/H 2112

ghost frames is a term i use to describe video frames which do not actually exist in a video file but which are sometimes revealed when using damaged data and/or glitch processes. for the sake of discussion, i'll also use "ghost frames" to refer to the process i use to invoke these frames. my process involves a bug in certain versions of avidemux, though there are likely other ways you could do something similar. (nick extracrispy tells me he can do something similar in quicktime, for example.)

specifically, i use avidemux version 2.5.4. the process is likely to work in other 2.5 and earlier versions, though i haven't tested them. it definitely does not work in the current version, 2.6. also, during the workshop, some mac users reported that they couldn't get avidemux to install. for os x lion/mtn lion, check these instructions for installing avidemux.

i initially discovered ghost frames thanks to another glitchy behavior in avidemux. my desktop computer runs windows 7 and has a video capture card for recording tv signals off a coax connection. the default tv capture program in windows 7 is called windows media center, which records programs in a format called WTV. WTV is proprietary (closed) format, but it's close enough to MPEG that when i try to open a WTV file in avidemux 2.5.4, it asks me "This looks like an MPEG. Do you want to index it?"

answering yes to this question and no to any follow-up questions results in a video that is recognizable but thoroughly mangled. here are some typical examples:


occasionally you'll get weirder, unpredictable glitches like this:


i'd been playing around with this wtv transcoding glitch for months before i saw my first ghost frame, which i discovered by accident. to invoke ghost frames in avidemux, scroll through a damaged video backwards. just skip to the end (or any point in the middle, if you prefer), and use your left arrow key to reverse through the file. if your file is damaged in the "right" way (say, via WTV transcoding), then you'll start to see frames that aren't really there:


what seems to be happening here is that avidemux is getting confused and applying incremental changes in the wrong direction. to save space, MPEG files only occasionally send full frames (keyframes or i-frames) and fill the rest of the video with p- and b- frames that only describe which pixels have changed since the previous frame. reversing through the file seems to trick avidemux into applying these changes wrong, thus revealing glitched frames that aren't actually in the file. (and i love the fact that you do this by going in reverse; it really makes it seem like some magic ritual.)

you can even do something i call dancing between the keyframes, inching back and forth through a glitchy area of the file as the artifacts become increasingly pronounced:


of course, it's one thing to see a ghost, and something else altogether to capture a ghost. ghost frames disappear just as suddenly as they appear. skip so much as one frame too far and those ghostly glitches you've been cultivating could vanish. you can't just hold down the left arrow key and storm through the place: you have to inch along. you have to creep.

so that's how you summon ghost frames from WTV files. it's all well and good if you're running windows 7 with a tv capture card, and have video content you can pipe through a coax connection, but that's a fairly narrow demographic. also, WTV transcoding introduces some artifacts i'd prefer to be able to turn off, like the banding at the top of the screen. so when preparing for the ghost frames workshop, i spent a few hours digging around for non-WTV files that would work with this process. most files i tried wouldn't. but by chance, i found one file that did. further investigation revealed that the teaser videos on NSFW adult website could be used to summon ghost frames—but only the videos from the past several months. (i don't have a subscription to the site so i don't know if the full-length subscriber videos glitch in the same way, though it seems likely.)

fun glitches! but because i found these files in the wild and they seem to be normal working video files, i don't know what about them makes them glitch like this. more about that below.

areas to explore

  1. crack the mystery of what makes the ellinude videos glitch. is it something in the encoding settings? something in the camera that shot them? something in the actual frame content? a combination, or other factors? the obvious goal is to reproduce these effects on files of our own choosing.
    my analysis suggests these files were encoded using ffmpeg, but i haven't quite been able to reverse-engineer the encoding settings. (and don't know if it would do much good even if i could.) some metadata from some of the video files is available here (thanks to antonio roberts for his help compiling this metadata).
  2. if we can summon ghost frames from transcoded WTV files and from ellinude's MP4s, then they could likely be found in other types of mangled/miscoded video. damaged/databent files, deliberately poor encoding, hacked codecs, etc are possible avenues for source video.
  3. this process has a lot of similarities with datamoshing. the two processes could likely be combined to interesting effect.
  4. version/system sensitivity testing—will this process work in other versions of avidemux, and if so which ones? will the same file produce the same ghost frames using different versions of avidemux or different operating systems?
  5. identify other tools/processes for summoning ghost frames.