Difference between revisions of "Help:Recording demos"

From Team Fortress Wiki
Jump to: navigation, search
(Movie Creation Tutorial)
m
 
(27 intermediate revisions by 25 users not shown)
Line 1: Line 1:
 
{{Help navbar}}
 
{{Help navbar}}
 
+
{{update}}
 
== Console commands ==
 
== Console commands ==
  
Line 7: Line 7:
 
! class="header" | Description
 
! class="header" | Description
 
|-
 
|-
|'''Record''' ''<filename>''
+
|'''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
+
|Starts recording a demo of the current gameplay under the specified filename. The demo will be saved as ''<filename>''.dem in your game folder {{code|\Steam\SteamApps\common\team fortress 2\tf\}} along with all its associated files.
 
|-
 
|-
|'''Stop'''
+
|'''stop'''
 
|Stops recording the current demo
 
|Stops recording the current demo
 
|-
 
|-
|'''Demoui''' or '''Demoui2'''
+
|'''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.
 
|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>''
+
|'''playdemo''' ''<filename>''
|Plays back a pre-recorded demo of name specified in <filename>
+
|Plays back a pre-recorded demo of name specified in <filename>.
|-
 
|'''Stopdemo'''
 
|Stops playback of the currently playing demo
 
 
|-
 
|-
|'''Listdemo''' ''<demoname>''
+
|'''stopdemo'''
|Provides details of the specified demo file
+
|Stops playback of the currently playing demo.
 
|-
 
|-
|style="white-space: nowrap" | '''Demo_recordcommands''' ''<0/1>''
+
|'''listdemo''' ''<demoname>''
|If set to 1, records any commands typed at the console into demo files
+
|Provides details of the specified demo file.
 
|-
 
|-
|'''Startmovie''' ''<filename>'' ''[avi/raw]''
+
|'''startmovie''' ''<filename>'' ''[avi/raw]''
|Starts recording movie frames, stored in your game folder (..\Steam\SteamApps\<username>\team fortress 2\tf\) as .tga files.
+
|Starts recording movie frames, stored in your game folder {{code|\Steam\SteamApps\common\team fortress 2\tf\}} as .tga files.
A recent feature to HL2 is the ability to record directly to AVI (PC version) by specifying <code>avi</code> as a paremeter. 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.
+
A recent feature to the PC version of the Source Engine is the ability to record directly to AVI by specifying {{code|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: <code>Startmovie mymovie avi</code> will record a mymovie.avi to your game folder
+
Example: {{code|Startmovie mymovie avi}} will record a mymovie.avi to your game folder.
 +
<br>'''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'''
+
|'''endmovie'''
 
|Stops recording movie frames.
 
|Stops recording movie frames.
 
|-
 
|-
|'''Demo_debug''' ''<0/1>''
+
|'''demo_debug''' ''<0/1>''
|Shows additional demo debug info
+
|Shows additional demo debug info.
 
|-
 
|-
|'''Demo_fastforwardstartspeed''' ''<factor>''
+
|'''demo_fastforwardstartspeed''' ''<factor>''
 
|Go this fast when starting to hold FF button.  
 
|Go this fast when starting to hold FF button.  
 
|-
 
|-
|'''Demo_fastforwardramptime''' ''<seconds>''
+
|'''demo_fastforwardramptime''' ''<seconds>''
|How many seconds it takes to get to full FF speed
+
|How many seconds it takes to get to full FF speed.
 
|-  
 
|-  
|'''Demo_fastforwardfinalspeed''' ''<factor>''
+
|'''demo_fastforwardfinalspeed''' ''<factor>''
|Final playback speed when holding the FF button
+
|Final playback speed when holding the FF button.
 
|-  
 
|-  
|'''Demo_interpolateview''' ''<0/1>''
+
|'''demo_interpolateview''' ''<0/1>''
|Enables/disabled view interpolation between demo ticks
+
|Enables/disabled view interpolation between demo ticks.
 
|-
 
|-
|'''Demo_quitafterplayback''' ''<0/1>''
+
|'''demo_quitafterplayback''' ''<0/1>''
|Quits game after demo playback
+
|Quits game after demo playback.
 
|-   
 
|-   
|'''Demo_recordcommands''' ''<0/1>''
+
|'''demo_recordcommands''' ''<0/1>''
|Record commands typed at console into .dem files
+
|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.
 +
|-
 +
| style="white-space:nowrap" | '''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_pause''' ''[seconds]''
+
|'''demo_timescale''' ''<scale>''
|Pauses demo playback, seconds optional
+
|Set the demo playback speed as a factor, a ''scale'' of 1.0 is normal playback.
 
|-
 
|-
|'''Demo_resume'''
+
|'''ds_record'''
|Resumes demo playback
+
|Start recording a demo manually.
 
|-
 
|-
|'''Demo_togglepause'''
+
|'''ds_stop'''
|Toggles demo pause/playback
+
|Stop recording a demo manually.
 
|-
 
|-
| style="white-space:nowrap" | '''Demo_gototick''' ''<tick>'' ''[relative]'' ''[pause]''
+
|'''ds_mark''' ''<comment>''
|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
+
|Bookmark the current demo tick count for future reference. The <comment> is an optional descriptor you may include.
 
|-
 
|-
|'''Demo_timescale''' ''<scale>''
+
|'''ds_status'''
|Set the demo playback speed as a factor, a ''scale'' of 1.0 is normal playback 
+
|Report the current recording status.
 
|}
 
|}
  
==Basic Demo Recording==
+
==Basic Demo Recording==  
 
A demo recorded for Team Fortress 2 captures the following:
 
A demo recorded for Team Fortress 2 captures the following:
 
* Gameplay from the perspective of the player recording the demo
 
* Gameplay from the perspective of the player recording the demo
 
* All HUD elements including chat / console text messages
 
* All HUD elements including chat / console text messages
 
* Audio received by the player through the voice chat system
 
* Audio received by the player through the voice chat system
 
  
 
There are limitations to note when recording a demo:
 
There are limitations to note when recording a demo:
Line 84: Line 93:
 
* The demo only records what was necessary to render audio and video for the player.
 
* 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 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.   
+
** The player cannot externally view their own character during play unless they taunt or die. However, turning on {{code|sv_cheats}} during demo playback and using the {{code|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 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.   
+
** 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. 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.)
+
* 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, {{code|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.   
 
* 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.
 
* 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===
 
===Recording Tutorial===
[[image:Demo_tutorial_Record.JPG|thumb|300 px|right|Demo recording console command: '''record''']]
+
[[File:Demo_tutorial_Record.JPG|thumb|300 px|right|Demo recording console command: '''record''']]
[[image:Demo_tutorial_Stop.JPG|thumb|300 px|right|Demo recording console command: '''stop''']]
+
[[File:Demo_tutorial_Stop.JPG|thumb|300 px|right|Demo recording console command: '''stop''']]
 
This procedure will create a short demo on a private server.
 
This procedure will create a short demo on a private server.
# Start Team Fortress 2.
+
# Ensure that the developer console is enabled.
# In options, ensure that the developer console is enabled.
+
#* '''Option 1)'''
 +
#* Start ''Team Fortress 2''.
 
#* On the main menu, choose Options.
 
#* On the main menu, choose Options.
 
#* On the Keyboard tab, click Advanced.
 
#* On the Keyboard tab, click Advanced.
 
#* Place a checkmark in '''Enable developer console'''.
 
#* Place a checkmark in '''Enable developer console'''.
 +
#* '''OR'''
 +
#* '''Option 2)'''
 +
#* In your Steam Library, click ''Team Fortress 2'' with your {{key|MOUSE2}}.
 +
#* Go to '''Properties'''.
 +
#* In a window that opens, press '''Set launch options'''.
 +
#* Type in box the following: {{code|-console}}.
 +
#* Press '''OK''' and close '''Properties''' window.
 +
#* Console opens automatically when you start ''Team Fortress 2''.
 +
# Start Team Fortress 2.
 
# Create a server.
 
# Create a server.
 
#* On the main menu, click Create Server.
 
#* On the main menu, click Create Server.
#* On the Server tab, choose any desired map such as ctf_2fort.
+
#* On the Server tab, choose any desired map, such as {{code|ctf_2fort.bsp}}.
 
#* On the Game tab, set the Server password to prevent other players from joining during this test.
 
#* On the Game tab, set the Server password to prevent other players from joining during this test.
 
#* Click Start.
 
#* Click Start.
Line 108: Line 126:
 
#* Choose a team and character class as normal, such as a Blu Scout.
 
#* Choose a team and character class as normal, such as a Blu Scout.
 
#* After spawning, open the developer console.  The default key is ~ (tilde).
 
#* 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''.
+
#* On the console's command line, enter {{code|record demotest}}.  This will record the demo to a file called {{code|demotest.dem}}.
 
#* The game is now recording.   
 
#* The game is now recording.   
 
#** Close the console.
 
#** Close the console.
Line 116: Line 134:
 
# After recording for a suitable period of time, stop recording.
 
# After recording for a suitable period of time, stop recording.
 
#* Open the console.
 
#* Open the console.
#* On the command line, enter '''stop'''.  ''Note: disconnecting from a game while recording a demo will also stop recording.''  
+
#* On the command line, enter {{code|stop}}.  ''Note: disconnecting from a game while recording a demo will also stop recording.''  
 
#* The console will return the total time and frames recorded.
 
#* 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===
 
===Playback Tutorial===
[[image:Demo_tutorial_demoui.JPG|thumb|300 px|right|demoui interface]]
+
[[File:Demo_tutorial_demoui.JPG|thumb|300 px|right|demoui interface]]
[[image:Demo_tutorial_demoui2.JPG|thumb|300 px|right|demoui2 interface]]
+
[[File:Demo_tutorial_demoui2.JPG|thumb|300 px|right|demoui2 interface]]
 
This procedure will load the demo recorded in the Recording tutorial.
 
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.
+
# In the console, enter {{code|demoui}}.  This opens a Demo Playback window.  Pressing {{key|Shift}}+{{key|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.
+
# Click Load in the Demo Playback window.  This opens a file browser, which defaults to {{code|\Steam\SteamApps\common\team fortress 2\tf\}}.
 
# Find ''demotest.dem'' and open it.
 
# Find ''demotest.dem'' and open it.
 
# Playback will begin.   
 
# Playback will begin.   
 
#* All characters in the recorded game will follow every instruction given during play.
 
#* 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.
+
#* 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.
 
#* 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:
 
#* Common Demoui controls:
Line 137: Line 156:
 
#** '''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.
 
#** '''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.   
 
#** '''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.
+
#* There is also a {{code|demoui2}} console command which opens a streamlined Demo Playback window.  It does not feature some of the buttons found on the {{code|demoui}} version like Drive.
  
 
===Movie Creation Tutorial===
 
===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  
+
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  
[[image:Demo_tutorial_Startmovie.jpg|thumb|300 px|right|Console command: '''startmovie''']]
+
[[File:Demo_tutorial_Startmovie.jpg|thumb|300 px|right|Console command: {{code|startmovie}}]]
# 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.
+
# In the console, enter {{code|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.
 
# 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.
+
# In the console, enter {{code|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 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 {{code|\Steam\SteamApps\common\team fortress 2\tf\}}.
 
#* The following occurs during startmovie processing:
 
#* 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).
+
#** 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.
+
#** Stuttering audio or no audio will be heard.  This is because {{code|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.
 
#* When the end of the demo is reached, the console will reappear.
# In the console, enter '''endmovie'''.  The console will return "Stopped recording movie..."   
+
# In the console, enter {{code|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.   
+
# Exit Team Fortress 2 and navigate to {{code|\Steam\SteamApps\common\team fortress 2\tf\}}.   
 
#* The Wave file is saved as mymovie.wav.
 
#* 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.
 
#* 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 [http://www.virtualdub.org/ 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.
 
These files can be combined into a single movie file by using software such as [http://www.virtualdub.org/ 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.
 
# Open VirtualDub.
# Choose '''File > Open > Open video file... '''
+
# Choose {{code|File > Open > Open video file...}}
# Navigate to the folder Steam\SteamApps\(user account)\team fortress2\tf.
+
# Navigate to the folder {{code|\Steam\SteamApps\common\team fortress 2\tf\}}.
 
# Choose the first TarGA (.tga) file in the movie's sequence.   
 
# 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.   
 
#* 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.
 
#* 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.   
+
# Go to {{code|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.   
 
#* 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.
 
#* 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.
+
# Go to {{code|Audio > WAV Audio...}}.  Select the Wave (.wav) file with the matching name of the movie from {{code|\Steam\SteamApps\common\team fortress 2\tf\}}.
# After setting the WAV Audio track, set '''Audio > Full processing mode'''.  This will enable audio compression.
+
# After setting the WAV Audio track, set {{code|Audio > Full processing mode}}.  This will enable audio compression.
# Go to '''Audio > Compression'''.  The editor chose MPEG-Layer 3.
+
# Go to {{code|Audio > Compression}}.  The editor chose MPEG-Layer 3.
# Go to '''File > Save as [[Wikipedia:AVI|AVI]]...''' The user can specify a name for the output movie file.  Specify a name and click OK.
+
# Go to {{code|File > Save as [[Wikipedia:AVI|AVI]]...}} The user can specify a name for the output movie file.  Specify a name and click OK.
# VirtualDub will generate the movie file.
+
# VirtualDub will generate the movie file. ({{code|Close video file}} before attempting to view the result.)
 
 
 
 
<!--{{youtube|Zg3jv2wTQwM}}
 
''Sample movie output. The titles and narration were edited in with [[Wikipedia:Windows Movie Maker|Windows Movie Maker]].''-->
 
 
 
  
 
Or you can directly make video file from TF2 using the following tutorial (taken from the steam community TF2 forums posted by Kuiper):
 
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:
+
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:
+
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 {{code|record [demoname]}} in the console while you are playing and {{code|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.
 
# 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.)
+
# Open up the console and enter the following commands: {{code|sv_cheats 1}} and {{code|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.)
# 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
+
# Start playing the demo either via the console command {{code|playdemo [demoname]}} or the demo ui accessed via the command {{code|demoui}} or keyboard shortcut {{key|shift}}+{{key|f2}}.
# When you get to the part of the demo that you want to record, type "'''startmovie [videofilename] avi'''"
+
# When you get to the part of the demo that you want to record, type {{code|startmovie [videofilename] h264}}.
# 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 [http://www.google.com/search?q=cccp CCCP] or [http://www.codecguide.com/download_mega.htm K-Lite] (pick one, you can try the other if it's not working).
+
# 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 [http://www.cccp-project.net/ CCCP] or [http://www.codecguide.com/download_mega.htm 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.
 
# 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.
+
# Type {{code|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
+
# 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. {{code|\Steam\SteamApps\common\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.
+
# 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===
 
===Sharing Demo files===
.DEM files created by the demo recorder can be shared with other users.
+
{{code|.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 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.
+
* 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 [[Wikipedia:File_archiver|file archival software]] such as [http://www.7-zip.org/ 7zip] or [http://www.rarlab.com/ WinRAR].
+
* {{code|.DEM files}} exhibit good compression when processed by [[Wikipedia:File_archiver|file archival software]] such as [http://www.7-zip.org/ 7zip] or [http://www.rarlab.com/ WinRAR].
  
 
===Troubleshooting===
 
===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 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.
 
* 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.
+
* 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.
 
* Screen shots and recorded frames will appear black when Multi-Core support is enabled. Turning off this feature should fix the problem.
  
 
==Additional Links==
 
==Additional Links==
* [http://developer.valvesoftware.com/wiki/Demo_Recording_Tools Valve Developer Community: Demo Recording Tools]. This page contains instructions for creating and manipulating demos in supported [[Wikipedia:Source_engine|Source]] games such as Team Fortress 2.  It details additional functionality such as demo smoothing and customizing commands.
+
* {{vdc|Demo Recording Tools}}. This page contains instructions for creating and manipulating demos in supported [[Wikipedia:Source_engine|Source]] games such as Team Fortress 2.  It details additional functionality such as demo smoothing and customizing commands.
 
 
 
* [http://www.youtube.com/watch?v=l4MK_XJeNqA Source Record Tutorial]: A demonstration film posted to YouTube covering record, startmovie, and movie creation.
 
* [http://www.youtube.com/watch?v=l4MK_XJeNqA Source Record Tutorial]: A demonstration film posted to YouTube covering record, startmovie, and movie creation.
  
* [http://www.free-codecs.com/download/K_Lite_Codec_Pack.htm K-Lite Codec Pack]: A collection of codecs for encoding and decoding different movie formats.
+
== See also ==
 +
*[[Replay]]

Latest revision as of 12:32, 10 December 2023

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