Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: CMVSource 1.0.0 - Load Dwarf Fortress movies in Avisynth  (Read 2190 times)

Crackmaster

  • Escaped Lunatic
    • View Profile
    • http://www.gyroshot.com/
CMVSource 1.0.0 - Load Dwarf Fortress movies in Avisynth
« on: October 28, 2011, 11:14:06 pm »

Download

Loads Dwarf Fortress CMV and CCMV movies in Avisynth (which is Windows-only, though people have had success running it on Linux by way of Wine). Requires a tileset and colors file, either from a DF installation or custom files you specify.

Supported formats:


Unsupported:

  • CCMVs produced by the CMV Editor (see documentation for details)

----

I knew I'd forgotten something! I finished this project almost a week ago, put it online, and have had this nagging feeling in the back of my mind ever since. I made note of the plugin in a couple of places, but I'm embarrassed to admit I forgot to bring it up here. Whether anyone finds this thing worth using or not, you have my apologies for not mentioning it sooner.

For those not familiar, Avisynth is a scripting engine for video editing and processing. It acts as a frameserver, only generating output frames when they're requested by the calling application, thereby saving disk space compared to rendering intermediate files. Users can write scripts to directly process a particular piece of video footage, but can also write generic script functions (using the Avisynth language to encapsulate a series of instructions without writing a full on C/C++ plugin) and, of course, actual C/C++ plugins. CMVSource is one such plugin.

I know there's the DFMA movie viewer, and Fraps/Camtasia/countless other screen capture programs, but I thought something more direct might prove useful in some cases (that, and I wanted to flex my plugin-writing muscles). Open a CMV/CCMV file in an Avisynth script and you can edit the clip, adjust the color, crop, resize, and so on, then feed it into whichever video encoder you prefer, as long as it works with Avisynth; since Avisynth is invoked either by direct support in a given application or just the standard Windows AVIFile interface, this includes a great many programs, among them VirtualDub, MeGUI, and x264. Instead of having to record a gigantic video file while playing the game, or while using the in-game movie playback function, you can use the CMV directly, with the added benefit of being able to swap out the tileset at your leisure, without having to change your init file every time you want to try something new.

There are two main drawbacks to using CMVSource: one, that there's no audio support at the moment. The only CMVs with audio, as far as I know, are the ones included with the game, so hopefully that won't be too obnoxious. The other is admittedly more significant, that like the game's CMV playback, creature graphics are not displayed correctly; you'll see only a standard tile, tinted according to the tile attributes, as if you were using only the tileset and not the creature graphics themselves. This is the biggest reason to stick with something like Fraps, and if possible I'll address this in a future release.

Curious development-minded parties will find full source code included, since CMVSource, like Avisynth itself and most other plugins, is released under the GNU GPLv2. Everything necessary to compile the plugin itself is in the zip, but you'll need the Boost libraries to compile and run my unit tests; find a copy of 1.47.0 mirrored at my site: http://www.gyroshot.com/cmvsource.htm You may also be interested in a more technically-oriented discussion, from a more Avisynth-specific point of view, in which case you can head to Doom9: http://forum.doom9.org/showthread.php?t=162850

If you find yourself interested in this sort of thing, you may also get a kick out of the similarly DF-inspired TurnsTile, which uses a tileset system (I call them tilesheets there, though) to apply a mosaic effect to your input video, as seen here: http://www.youtube.com/watch?v=WFJreg-LW50

I'm always open to ideas and/or corrections, and if anyone has any questions I'll do my best to answer them. Here's hoping someone gets some use out of this thing!
Logged

dirkzen

  • Bay Watcher
  • Flood the depot. Get free stuff.
    • View Profile
Re: CMVSource 1.0.0 - Load Dwarf Fortress movies in Avisynth
« Reply #1 on: October 28, 2011, 11:36:42 pm »

This sounds so awesome that I sort of feel bad for not knowing what the hell to do with it..
Logged
Forgotten beasts flying up the wells and eating them might cause some negative effects.

Miuramir

  • Bay Watcher
    • View Profile
Re: CMVSource 1.0.0 - Load Dwarf Fortress movies in Avisynth
« Reply #2 on: October 31, 2011, 09:18:40 am »

...CMVSource is one such plugin. ...

Regarding your comment about fast divides: the authoritative source for this right now seems to be Ridiculous Fish's 3rd version, released Oct. 14.  Fish's second version, from Dec. 2010, was already apparently enough faster that people found it important, and the third version improves performance on uncooperative numbers. I'm still trying to wrap my head around it; hopefully it will work its way into compiler optimization eventually because it's well below the level I want to worry about for most projects, but when you're doing video encoding or other time-critical stream processes it may be important to deal with this level of detail. 
Logged

Crackmaster

  • Escaped Lunatic
    • View Profile
    • http://www.gyroshot.com/
Re: CMVSource 1.0.0 - Load Dwarf Fortress movies in Avisynth
« Reply #3 on: October 31, 2011, 08:12:51 pm »

That's great, thanks! I can't say math is my strong suit, but with reference implementations available I should be able to give those techniques a shot. Looking at RF's blog, I see that the first entry in "Labor of Division" explains the magic number optimization I'm already seeing from MSBuild, so with a little elbow grease I should have a better handle on the subject sooner or later.
Logged