Snarkpit Articles


NOTE (anno 2006): The technique covered in this tutorial also works for Source games.

This guide covers all the aspects of creating a good HL-movie. A movie with gameplay in progress tells a lot more about your map than some screenshots, and it isn't that hard either.

I realise a lot of tutorials like these are around, but I'd like to make this clear for once and for all.

All actions in this tutorial are the same for Steam and older HL versions. The only thing that will be different is the look and feel of the console, but the commands and the method stay the same.

Step 1: Creating/Viewing a demo



Unless you're using a program like Fraps (see note at the end) it's impossible to directly produce a movie from a game you're playing. Most hardware would be unable to handle it, and your framerate would look bad. Besides, how can you concentrate on your game when you have to watch all those movie controls too ...

So HL developers came up with something handy: a demo. A demo is in fact nothing more than a file where all your movements and all movements from things/characters you actually see are stored, as commands. Anyone with the HL-engine can read these series of logged actions and reconstruct (and see) exactly what you saw when you were playing the game.

The advantage of a demo is that it just stores actions as, in fact, text lines ... which demands a minimum of CPU power (almost nothing), so it doesn't effect gameplay/fluency at all. The disadvantages are:

- If you want to play the demo, you'll need HL (& the mod you were using.)
- When creating a movie from a demo, sound will not be transferred. (because the output consists of just a bunch of Image files we have to slap together for ourselves ... see more below.)

Now how do you create a demo?
  • Open up the console (this can be in a single player game, in a multiplayer game in progress, when you're spectating someone else ... doesn't matter which mod or situation.) and use this command: "record (demoname)". For example "record myfirstdemo".
  • Play your game as long as you want.
  • To stop recording the demo: "stop". If you want to record again, but just append it to an existing demofile, just use the record command again with the same demoname.
So, you've got your demo ... now how do you watch it?
  • Bring up the console again. (when a multiplayer game is in progress, note that you will be disconnected. It's best to load a demo when you're not playing anything, but it's not dangerous, too.)
  • Use the command "playdemo (demoname)". For example: "playdemo myfirstdemo". After the map has loaded, the demo starts playing. When it's finished, you get the console again. You can stop it anytime by using "stopdemo".

    Note: some mods & all steam-powered games support the command "viewdemo (demoname)". This has the advantage of giving you a small VGUI to control the demo (playback rate, rewind, forward ....). Use it whenever possible.
NOTE: If you want to record what every player on your server sees, you'll need a special kind of demo, a HLTV demo. More information about creating HLTV demo's (this is kinda advanced) on the The Specialists Mod Boards.

Step 2: Produce your movie frames



Now you've got the demo, it's time to start building your movie. Again, HL doesn't support direct output of movie files, but it will just export every frame you see to a BMP file ... we'll merge these images together later on.
  • The first thing you've got to do is to switch to a nice resolution. (1024*760-scaled movies would be overkill). Switch to 640*480 or something like that, and make sure your gamma and brightness settings are reasonable.
  • Start your demo (see above)
  • Whenever you want to start producing the frames, use the command "startmovie (filename) (fps)". For example: "startmovie test 30". This would produces 30 BMP's for every second you're recording, and they would be named like this: "test001", "test002", "test003", ...

    Remember, demo recording starts when you ban the console. If you use the command and just stare at the console, nothing will happen, so make sure you get rid of it when recording. When you load it up again, demo recording will stop. Just load up and ban the console when you want to record.
  • You can stop recording at all with the "stopmovie" command.
A series of BMP's have been made now. Look for them. (they usually are in your mod folder, or in the valve folder if it's regular HL.)

Step 3: Merging the BMP's



Most people refer to a program like Videomach for this, but that isn't freeware. Virtualdub is, and it's a lot easier with this handy program. Everyone should have it installed, you'll need it sooner or later.

Now, load up Virtualdub and choose file->open video file. Browse to the right folder and select the first BMP (the one that ends with "001". Hit "open", and Virtualdub automatically loads the whole BMP goodness as one movie!

Let's save this now. Saving your movie as a raw AVI file is a big no-no. Your movie would be very big and not download-friendly. Would take ages to load, too.

Once again, Virtualdub comes with a solution. Select video->compression (or hit CTRL+P) and a new window will appear.



Now look at that! All the video codecs you installed on your PC can be a choice for compressing your movie... select one of them, and hit OK. (some movies have size restrictions, but since we used a valid resolution to record our movie, most of them are OK. We also suggest you try the latest version of DivX using 'multipass' for best results). Xvid or Intel Indeo Video are good choices too. Just test them out, you can always save your movie again with another compression, as long as you don't close virtualdub.

The final step is to actually build your movie. Choose file->save as AVI. Give your movie a name, and the process will start. When you used a compression, this could take a while, but it's worth it.

After you built your movie, you can delete the BMP's.

Whew. You built your first HL movie, and it is now ready for editing with any video editor. (again, Virtualdub is a good tool! Take a look at the site for some tutorials, or go and experiment for yourself)

Optional step: recording sound



If you want movies with ingame-sound, you'll have to use a program like Fraps. (working demo version available). This tool records a video file while you're playing the game or playing a demo, including the original sound. Make sure your PC has the muscles for it, because the CPU will get a heavy load.

Another option is to record the sound yourself whilst playing your demo. By using Audacity (audacity.sourceforge.net) you can record any audio being produced by your sound card. Start recording before you run the demo, play it, and save the file as a .WAV afterwards. You can synchronize video/audio by using any video editor, Virtualdub for example.

(images and more thorough explanation to come !)


Post ReplyView Topic
Discussion
[author]
Posted by Forceflow on Wed Nov 29th 2006 at 11:34pm

I don't think the GoldSource engine supports playing AVI cutscenes. Not sure, though.
0 starsPosted by Le Chief on Mon Oct 9th 2006 at 11:26am

Hey this is pretty cool for recording multiplayer games and all but I'm making a single player campaign and I need to add "avi's" during the game play. Is that possible. Probley not.

Good tut though. smiley
[author]
Posted by Forceflow on Thu Jun 22nd 2006 at 5:19pm

Well, it has been here all the time, Orph. smiley
0 starsPosted by Orpheus on Thu Jun 22nd 2006 at 12:31pm

This tutorial is just under 2 years old. Where in the hell has it been hiding?
0 starsPosted by Foxpup on Mon Nov 29th 2004 at 2:21am

To get sound: Start Sound Recorder, press record and leave it running in the background while you play your demo. Oh, and make sure you select LINE as your recording control, and set the file format to stereo. You'll probably need to do some tweaking 'cause Sound Recorder sometimes stops recording after 60 seconds (it's a Microsoft product, what do you expect). You'll also have some problems getting the sound in sync with the pictures, but I reckon this could be overcome. This is just an idea, I haven't tried it yet
0 starsPosted by 7dk2h4md720ih on Fri Jul 16th 2004 at 1:24am

0 starsPosted by Dred_furst on Fri Jul 9th 2004 at 9:54pm

If youve got nice hardware, you can use fraps to capture video from demos smiley but only at 640x480.
[author]
Posted by Forceflow on Tue Jul 6th 2004 at 9:15pm

Yeh ... without a video capturing program like fraps it's nearly impossible ... (sure, you could extract the sounds from a GCF or PAK and synchronize them with the movie with an editing program ... but that would be ... out of yer mind smiley )
0 starsPosted by Gorbachev on Tue Jul 6th 2004 at 8:49pm

Yeah, it's tough to get the in-game sound for the finished .avi. All demos have sound when you play them in game. But to get an .avi with the proper in game sound requires a lot of work and isn't really worth it.
Post ReplyView Topic