Help:Recording demos

From Team Fortress Wiki
(Redirected from Recording demos)
Jump to: navigation, search

Console commands

Command Description
record <filename> Starts recording a demo of the current gameplay under the specified filename. The demo will be saved as <filename>.dem in your game folder \Steam\SteamApps\common\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.
startmovie <filename> [avi/raw] Starts recording movie frames, stored in your game folder \Steam\SteamApps\common\team fortress 2\tf\ as .tga files.

A recent feature to the PC version of the Source Engine is the ability to record directly to AVI by specifying avi as a parameter. When this parameter is used a windows codec dialogue box will be shown for you to select the codec so it is best to set TF2 to windowed mode before doing this. Example: Startmovie mymovie avi will record a mymovie.avi to your game folder.
Note that .avi is no longer supported. Attempts to record in .avi formats will issue a prompt telling the user to use h264 (Quicktime) instead.

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.
ds_record Start recording a demo manually.
ds_stop Stop recording a demo manually.
ds_mark <comment> Bookmark the current demo tick count for future reference. The <comment> is an optional descriptor you may include.
ds_status Report the current recording status.

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 their own character during play unless they taunt or die. However, turning on sv_cheats during demo playback and using the thirdperson console command works as normal.
    • Objects such as other players, buildings and weapons fire will not be visible beyond a certain distance from the player's current position if the player 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. It does record text messages in the game chat, however. (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.

Recording Tutorial

Demo recording console command: record
Demo recording console command: stop

This procedure will create a short demo on a private server.

  1. Ensure that the developer console is enabled.
    • Option 1)
    • Start Team Fortress 2.
    • On the main menu, choose Options.
    • On the Keyboard tab, click Advanced.
    • Place a checkmark in Enable developer console.
    • OR
    • Option 2)
    • In your Steam Library, click Team Fortress 2 with your MOUSE2.
    • Go to Properties.
    • In a window that opens, press Set launch options.
    • Type in box the following: -console.
    • Press OK and close Properties window.
    • Console opens automatically when you start Team Fortress 2.
  2. Start Team Fortress 2.
  3. Create a server.
    • On the main menu, click Create Server.
    • On the Server tab, choose any desired map, such as ctf_2fort.bsp.
    • On the Game tab, set the Server password to prevent other players from joining during this test.
    • Click Start.
  4. 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.
  5. 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.
    • Option 3)
    • As of the May 31, 2016 Patch, you can set the game to record demos automatically, and configure it from the Advanced Options menu.

Playback Tutorial

demoui interface
demoui2 interface

This procedure will load the demo recorded in the Recording tutorial.

  1. In the console, enter demoui. This opens a Demo Playback window. Pressing ⇧ Shift+F2 will also bring up this window.
  2. Click Load in the Demo Playback window. This opens a file browser, which defaults to \Steam\SteamApps\common\team fortress 2\tf\.
  3. Find demotest.dem and open it.
  4. 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 they 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

Console command: startmovie
  1. 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.
  2. 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.
  3. 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 a TarGA (.tga) image file for each video frame and a Wave(.wav) sound file for the audio track in \Steam\SteamApps\common\team fortress 2\tf\.
    • The following occurs during startmovie processing:
      • Each frame of video is saved as a TarGA 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.
  4. In the console, enter endmovie. The console will return "Stopped recording movie..."
  5. Exit Team Fortress 2 and navigate to \Steam\SteamApps\common\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.

  1. Open VirtualDub.
  2. Choose File > Open > Open video file...
  3. Navigate to the folder \Steam\SteamApps\common\team fortress 2\tf\.
  4. 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.
  5. 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.
  6. Go to Audio > WAV Audio.... Select the Wave (.wav) file with the matching name of the movie from \Steam\SteamApps\common\team fortress 2\tf\.
  7. After setting the WAV Audio track, set Audio > Full processing mode. This will enable audio compression.
  8. Go to Audio > Compression. The editor chose MPEG-Layer 3.
  9. Go to File > Save as AVI... The user can specify a name for the output movie file. Specify a name and click OK.
  10. VirtualDub will generate the movie file. (Close video file before attempting to view the result.)

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 framerate even if your hardware is low-end:

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:

  1. 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.
  2. 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 use 30 fps. Youtube has recently added a function allowing the upload and playback of 60fps videos.)
  3. 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.
  4. When you get to the part of the demo that you want to record, type startmovie [videofilename] h264.
  5. 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).
  6. 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.
  7. Type endmovie in the console when you are done recording.
  8. The resulting MOV 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. \Steam\SteamApps\common\team fortress 2\mymovie.avi.
  9. Now you can import the MOV 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-existent map file.
  • .DEM files exhibit good compression when processed by file archival software such as 7zip or WinRAR.

Troubleshooting

  • 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 solution to this issue.
  • Screen shots and recorded frames will appear black when Multi-Core support is enabled. Turning off this feature should fix the problem.

Additional Links

  • Demo Recording Tools on the Valve Developer Community. 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.

See also