.kkapture 0.01 - demo capturing made easy (hopefully)

category: code [glöplog]
toxie: the source is availible, if you make a fraps-mode out of them, send the updated sources to ryg! ;)
added on the 2005-04-07 15:23:46 by kusma kusma
hellfire, i already got working ddraw capture for kkapture 0.03, atleast for fullscreen productions. intercepting lock/unlock is not an option anyway, because it (by necessity) completely breaks when demos use hardware blits or d3d.

what i currently do is intercept IIDirectDrawSurface::Flip on the primary surface. i'll also need to intercept Blt/BltFast to make windowed demos work, that's on my todo list.

current code already works fine with contour/tbl (d3d6), metamorf/satori (plain ddraw), kasparov/elitegroup (d3d7) and zilog/sunflower (win32 version, ddraw).

"seems like the sound is generally delayed by about two frames, probably because of missing doublebuffer/vsync/soundprebuffer" - whether sound works properly or not depends a LOT on the exact demo and most importantly soundsystem used. i emulate a soundcard playing buffers, not simply store everything written into the sound buffers to disk; however there are a lot of very fiddly timing issues because sound rendering usually runs in a different thread, and i don't know which one. making sure that sound threads get enough time to render per frame is already the most complex issue regarding timing.

i'm working on it, but this is really the hardest problem of all ;)

toxie: realtime grabbing is totally beside the point of kkapture. use something like fraps for that. or feel free to make your own tool based on the kkapture sources :) - but this is just something i'm not interested in. it requires a completely different design - and would cause a lot of unnecessary problems and complexities in kkapture.
added on the 2005-04-07 15:34:11 by ryg ryg
ryg: no prob.. just thought that this feature could be cool to capture 96kb-games..
added on the 2005-04-07 15:38:01 by toxie toxie
learn to play in slowed-down time :)
added on the 2005-04-07 15:55:55 by ryg ryg
or implement demo-replay modes in your game where you record input, then play it back while using kkapture
added on the 2005-04-07 18:04:26 by bartman bartman
thanks a lot ryg! is working properly with threepixels ones!
added on the 2005-04-08 15:18:11 by mrdoob mrdoob
okay, there we go: version 0.03 available at


this release focuses on core functionality - all the little tidbits people have been asking about will be implemented somewhat later. the reason is that university starts again for me on monday and i wanted to get the hard stuff done before i'm busy with other things; i can do small fixes anytime. so if what you've asked about isn't in this version, chances are good it will appear in a later release.
added on the 2005-04-09 02:26:35 by ryg ryg
Thanks ryg! Hell of a way to spend your holiday, but hey, it's mightily appreciated!
added on the 2005-04-09 04:06:39 by Jerware Jerware
i wouldn't do this if i didn't enjoy it :)
added on the 2005-04-09 14:24:56 by ryg ryg
alrightie, works fine so far, only my xbox starts dropping frames when playing back 720x576@50fps 3000kbit/s xvid of fr025 :) gotta check out how to interlace and make an mpeg2 out of it. i love this tool!
added on the 2005-04-09 20:55:04 by bartman bartman
okay, i bet i'm going to get a lot of rtfm's now, but i have searched and can't find any info on this. here it goes:

i have loads of codecs installed here, but none of them shows up in the menu where i select codecs in kkapture. only that evil uncompressed is possible, and the result is quite hard to handle. any ideas why this happends?
added on the 2005-04-10 00:20:39 by gemini gemini
i burned my first test dvdr with fr025. and boy, running at 50 fps in anamorphic widescreen... sweet :)
here's my first avisynth script for all you people who're interested. it's not perfect yet, but i'm currently out of dvdr's and my dvd player is very picky and doesn't play +r or +rw..
i'll post a better version here when it's working
added on the 2005-04-10 00:29:36 by bartman bartman
alrightie, this script here seems to do the trick (have not yet verified on a standalone dvd player, but i'm pretty confident it's okay)
so here's the complete procedure i did:

i first kkaptured fr025 at 1024x768 with aspect ratio set to 16:9.
then in virtualdub, i resized to 720x540 with letterboxing to 720x576. saved with HuffYUV codec as fr025_huff.avi
resampled the wav to 48khz in sound forge.
made the following avisynth script:
SelectEvery(4, 1,2)
in TMPGEnc, use these settings:
Video>Encode mode: Interlace
Advanced>Video source type: Interlace
Advanced>Field Order: Top field first (field A)
Source aspect ratio: 4:3 625 line (PAL, 704x576)
Video arrange method: full screen

this will give you a PAL 16:9 anamorphic 50 fps video of the demo...
good night.
added on the 2005-04-10 01:11:03 by bartman bartman
gemini: for unknown reasons the codec drop-down menu don't work in all programs, but using your up-/down-arrow should do the trick.
added on the 2005-04-10 02:12:28 by px px
version 0.03b available.

fixes one timing bug in 0.03 and adds automatic adjustment so image width/height are multiples of 4 pixels (beware, this is by stripping pixels, not adding black borders ;). also fixes a bug in the d3d8 capture implementation (you should be able to capture d3d8 multisampling apps now).

the timing bug affected 155/95, so if you tried to capture it using kkapture 0.03, this will fix it.
added on the 2005-04-10 05:11:14 by ryg ryg
bartman: thank you, found the codecs now :)

the avi's that kkapture is outputting seems to have a broken index. atleast according to virtualdubmod. this seems to result in just around 10 seconds of the dump being found. is this a bug or am i just stupid? ;)
added on the 2005-04-10 14:25:15 by gemini gemini
check the log, are there any error messages in there?

broken index usually results went something went wrong during shutdown or shutdown didn't happen at all (i.e. the demo is still running in the background).
added on the 2005-04-10 14:45:16 by ryg ryg
the log says:

main: initializing...
video: capturing at 1280x1024
sound: waveOutOpen ffffffff (44100 hz, 16 bits, 2 channels)
avi: opened audio stream at 44100 hz, 2 channels, 16 bits
avi: opened video stream at 60.00 fps
main: shutting down...
avi: stopped recording
avi: avifile shutdown complete

nothing seems wrong or such. but the avi's tend to be around the same size (~4gb) .. i'm using no compression. maybe that is the problem?
added on the 2005-04-10 15:46:42 by gemini gemini
haha, 1280x1024x60fps uncompressed :DDDD
added on the 2005-04-10 15:48:49 by dodke dodke
gemini: the built-in AVI writer has a limit of ~2GB per AVI. that's probably why your avi is corrupt. try outputting to .bmp+.wav or use the lossless HuffYUV codec.
added on the 2005-04-10 15:49:46 by bartman bartman
bartman: aha .. again, thank you! :)
added on the 2005-04-10 15:52:28 by gemini gemini
use a lower resolution or compress the damn video. 1280x1024x60fps at 24bits takes way over 200mb per second!!!! (at 32bits even more) =)
added on the 2005-04-10 15:56:09 by dodke dodke
dodke: sure, but some productions don't allow any changes to the resolution..
added on the 2005-04-10 16:13:23 by gemini gemini
Nice Tool :) But some Demos or Intros seems to have some probs with it... No Zoom3 or Meet the biots videos are possible :(
added on the 2005-04-10 18:55:40 by Sapphire Sapphire
gemini, hex edit them!!
added on the 2005-04-10 19:10:45 by skrebbel skrebbel