From TF2 Wiki
|Record <filename>||Starts recording a demo of the current gameplay under the specified filename. The demo will be saved as demoname.dem in your game folder (..\Steam\SteamApps\[username]\team fortress 2\tf\) along with all its associated files|
|Stop||Stops recording the current demo|
|Demoui or Demoui2||Opens a small demo user interface which looks like a media player, but makes the opening and playing of demos much easier, including the capability to Fast Forward, Rewind and Skip to specific points in the demo. This can also be achieved by pressing Shift+F2 at any time.|
|Playdemo <filename>||Plays back a pre-recorded demo of name specified in <filename>|
|Stopdemo||Stops playback of the currently playing demo|
|Listdemo <demoname>||Provides details of the specified demo file|
|Demo_recordcommands <0/1>||If set to 1, records any commands typed at the console into demo files|
|Startmovie <filename> [avi/raw]||Starts recording movie frames, stored in your game folder (..\Steam\SteamApps\<username>\team fortress 2\tf\) as .tga files.
A recent feature to HL2 is the ability to record directly to AVI (PC version) by specifying
|Endmovie||Stops recording movie frames.|
|Demo_debug <0/1>||Shows additional demo debug info|
|Demo_fastforwardstartspeed <factor>||Go this fast when starting to hold FF button.|
|Demo_fastforwardramptime <seconds>||How many seconds it takes to get to full FF speed|
|Demo_fastforwardfinalspeed <factor>||Final playback speed when holding the FF button|
|Demo_interpolateview <0/1>||Enables/disabled view interpolation between demo ticks|
|Demo_quitafterplayback <0/1>||Quits game after demo playback|
|Demo_recordcommands <0/1>||Record commands typed at console into .dem files|
|Demo_pause [seconds]||Pauses demo playback, seconds optional|
|Demo_resume||Resumes demo playback|
|Demo_togglepause||Toggles demo pause/playback|
|Demo_gototick <tick> [relative] [pause]||Skips to a tick in demo. If the relative parameter is "1" the tick is an offset to the current tick. If the pause parameter is "1", playback will be paused when tick is reached|
|Demo_timescale <scale>||Set the demo playback speed as a factor, a scale of 1.0 is normal playback|
Basic Demo Recording
A demo recorded for Team Fortress 2 captures the following:
- Gameplay from the perspective of the player recording the demo
- All HUD elements including chat / console text messages
- Audio received by the player through the voice chat system
There are limitations to note when recording a demo:
- The demo relies upon the user having a copy of the map file related to the demo. The demo does not save a copy of the map that was played.
- The demo only records what was necessary to render audio and video for the player.
- The demo does not record the scoreboard at any time even if the player views it during recording.
- The player cannot externally view his own character during play unless he taunts, he dies, though turning on sv_cheats during demo playback and using the thirdperson console command does work.
- Objects such as other players, buildings and weapons fire will not be visible beyond a certain distance from the player's current position if he uses the Drive function in the Demo Playback window. The entire map is loaded but distant activity not in the player's line of sight may not be rendered at all times. Sprays are rendered at all times if the local cached spray still exists.
- The recorder does not capture the recording player's voice communication. However, he will see any text messages he entered in the game chat. (To record the player's voice, voice_loopback 1 must be set in the console. This forces the player's voice to be played back in the audio output.)
- If a server changes maps during a recording, the game will create a new demo file with the same name and an appended sequential number to avoid filename conflicts.
- A demo file cannot be started from within the operating system (e.g. double-clicking on it in Windows Explorer). A demo must be loaded from within the game by console command or demoui interface.
This procedure will create a short demo on a private server.
- Start Team Fortress 2.
- In options, ensure that the developer console is enabled.
- On the main menu, choose Options.
- On the Keyboard tab, click Advanced.
- Place a checkmark in Enable developer console.
- Create a server.
- On the main menu, click Create Server.
- On the Server tab, choose any desired map such as ctf_2fort.
- On the Game tab, set the Server password to prevent other players from joining during this test.
- Click Start.
- Once the map loads, recording may begin.
- Choose a team and character class as normal, such as a Blu Scout.
- After spawning, open the developer console. The default key is ~ (tilde).
- On the console's command line, enter record demotest. This will record the demo to a file called demotest.dem.
- The game is now recording.
- Close the console.
- Walk outside of your spawn area and jump and move about.
- Use a taunt. While taunting, look at the character from different perspectives.
- If the character is a Soldier or Demoman, use explosives to suicide.
- After recording for a suitable period of time, stop recording.
- Open the console.
- On the command line, enter stop. Note: disconnecting from a game while recording a demo will also stop recording.
- The console will return the total time and frames recorded.
This procedure will load the demo recorded in the Recording tutorial.
- In the console, enter demoui. This opens a Demo Playback window. Pressing Shift+F2 will also bring up this window.
- Click Load in the Demo Playback window. This opens a file browser which defaults to the Team Fortress 2 system folder in Steam program folder.
- Find demotest.dem and open it.
- Playback will begin.
- All characters in the recorded game will follow every instruction given during play.
- The player's view will pan and shift as the player did while recording. This includes viewpoints recorded during a respawn wait. The only way to override this by using the Drive function mentioned later.
- Each frame of the playback is a tick, and the current tick and total ticks in the demo are shown in the demoui window.
- Common Demoui controls:
- Pause pauses playback
- Stop returns to the game main menu
- The Timescale slider control adjusts the timescale, or playback speed. 100% is normal speed. 200% plays the demo twice as fast.
- Drive allows the viewer to use mouse and movement keys to change the perspective of the camera. It may appear counter-intuitive at first, so experimentation is suggested.
- Goto jumps to the tick typed by the user into the text box to the right of the Goto button.
- There is also a demoui2 console command which opens a streamlined Demo Playback window. It does not feature some of the buttons found on the demoui version like Drive.
Movie Creation Tutorial
The Source engine can generate audio and video files based on a recorded demo. The output audio and video can then be processed through video-creation software. The following procedure will generate output called mymovie based on the demo file created in the Recording tutorial demotest.dem. If you are making a High quality video for in use in a Machinima you can use ultra high settings for an added graphical boost
- In the console, enter startmovie mymovie. The game will prepare to save output to files starting with the name mymovie. The user can choose any name here.
- The console will return the message, "Started recording movie, frames will record after console is cleared...". The game is now ready to process the demo file.
- In the console, enter playdemo demotest. The playdemo command plays a demo from start to finish without any other user intervention.
- The game will process the demo file. It will generate an image file for each video frame in the Team Fortress 2 tf\ folder and a Wave sound file for the audio track.
- The following occurs during startmovie processing:
- Each frame of video is saved as a TarGA (.tga) image file. The game will appear sluggish as this is occurring. The file size of each image file will vary on the game's current resolution. A 1024x768 resolution frame is approximately 2,300 kilobytes (2.3 MB per file).
- Stuttering audio or no audio will be heard. This is because startmovie will directly lift the audio track from the demo file. All processing power is utilized in converting the video.
- When the end of the demo is reached, the console will reappear.
- In the console, enter endmovie. The console will return "Stopped recording movie..."
- Exit Team Fortress 2 and navigate to the folder (installation folder for Steam)\Steam\SteamApps\(user account)\team fortress 2\tf.
- The Wave file is saved as mymovie.wav.
- The TarGA file names begin with "mymovie" and end with a frame number. The first image in the sequence will be a multiple of 10, such as 01000.
These files can be combined into a single movie file by using software such as VirtualDub, a GNU-licensed video capture / processing utility. The following procedure builds on the prior examples in this article to merge the mymovie files into a movie file.
- Open VirtualDub.
- Choose File > Open > Open video file...
- Navigate to the folder Steam\SteamApps\(user account)\team fortress2\tf.
- Choose the first TarGA (.tga) file in the movie's sequence.
- Usually this is numbered similar to 01000; choose the file with the lowest number. Sorting by filename will help.
- If the first file in the sequence is not chosen, the images will be loaded sequentially starting with the one chosen.
- Go to Video > Compression. A video codec can be chosen. The editor chose XviD MPEG-4 Codec.
- A discussion on different codec choices is beyond the scope of this article. The user may need to experiment with different codecs to find one that generates the desired output.
- Failing to choose a proper codec (i.e. leaving it set as Uncompressed RGB) may yield a movie file with an unreasonable size.
- Go to Audio > WAV Audio.... Select the Wave file with the matching name of the movie from the tf\ folder.
- After setting the WAV Audio track, set Audio > Full processing mode. This will enable audio compression.
- Go to Audio > Compression. The editor chose MPEG-Layer 3.
- Go to File > Save as AVI... The user can specify a name for the output movie file. Specify a name and click OK.
- VirtualDub will generate the movie file.
Or you can directly make video file from TF2 using the following tutorial (taken from the steam community TF2 forums posted by Kuiper):
Here's how you can create a video using max graphics settings with constant framerates even if your hardware sucks:
If you haven't already done so, you need to record a demo of the gameplay that you want to create a video from. Do this by typing "record [demoname]" in the console while you are playing and "stop" when you are done. Once you have your demo file, follow these steps:
- Load up TF2 using the settings that you want to show in the video. This includes screen resolution. If you are planning to upload to a low-quality Streaming site, I advise using 640x480 so that it will take less time to render and upload. If you're uploading an HD video to Youtube, use 1280x720.
- Open up the console and enter the following commands: "sv_cheats 1" and "host_framerate 30" (You can record at a higher framerate if you want a 60 FPS video for editing purposes, but most streaming sites like Youtube use 30 FPS.)
- Start playing the demo either via the console command "playdemo [demoname]" or the demo ui accessed via the command demoui or keyboard shortcut shift+f2
- When you get to the part of the demo that you want to record, type "startmovie [videofilename] avi"
- You should get a pop-up window with a list of codecs to choose from. I recommend using the XviD codecs. If the list doesn't include the codecs you need, you may want to grab CCCP or K-Lite (pick one, you can try the other if it's not working).
- After you've begun recording the movie, allow the game to play out. The playback will be choppy and look buggy and the sound may loop or be completely muted. Don't worry, this is normal and the finished video will not look like this. Just allow the demo to play until it's gotten as far as you want to record. If you have a lower-end system or you're recording a rather lengthy video segment, this could take awhile, so you might want to find something else to do while the video renders.
- Type "endmovie" in the console when you are done recording.
- The resulting AVI file will not be located in your TF folder. It will be put in your "team fortress 2" folder with the name you required, e.g. C:/Program Files/Steam/SteamApps/bobsmith/team fortress 2/mymovie.avi
- Now you can import the AVI into Windows Movie Maker or whatever program you use if you need to do any further editing.
Sharing Demo files
.DEM files created by the demo recorder can be shared with other users.
- The other user must have the related game installed.
- The other user must have the map featured in the recording. The game will return an error if the demo tries to load a non-existant map file.
- .DEM files exhibit good compression when processed by file archival software such as 7zip or WinRAR.
- If the error "Unreliable snapshot error" is returned when loading a demo file, the user should try to load the demo file again.
- If an error regarding a missing map file is returned, the user must download the proper version of the map upon which the the demo recording took place and try again.
- There is a known issue of certain Team Fortress 2 patches, such as the April 29 Goldrush / Medic update, which makes demos recorded before that point unplayable. There is no known resolution to this issue.
- Screen shots and recorded frames will appear black when Muli-Core support is enabled. Turning off this feature should fix the problem.
- Valve Developer Community: Demo Recording Tools. This page contains instructions for creating and manipulating demos in supported Source games such as Team Fortress 2. It details additional functionality such as demo smoothing and customizing commands.
- Source Record Tutorial: A demonstration film posted to YouTube covering record, startmovie, and movie creation.
- K-Lite Codec Pack: A collection of codecs for encoding and decoding different movie formats.