Difference between revisions of "Demo Video Creation"

From Valve Developer Community
Jump to: navigation, search
(No more AVI support, sorry guys!)
(FFmpeg)
 
(8 intermediate revisions by 4 users not shown)
Line 6: Line 6:
 
# Load your chosen Source engine game and open the console.
 
# Load your chosen Source engine game and open the console.
 
# Set your graphics settings to be what you want the video settings to be. E.g. if you want an 800x600 video, set your resolution to 800x600. Also set whatever graphical niceties you want - you don't need to worry about keeping something that gives you a good in-game framerate, but don't go too high or you might find the recording takes an eternity. {{warning|Be aware of hard disk space requirements for long videos. An 800x600 resolution generates approximately 1.5 megabytes for every frame. It's easy to chew through gigabytes very quickly and if you run out of hard disk space, Source will just crash to desktop.}}
 
# Set your graphics settings to be what you want the video settings to be. E.g. if you want an 800x600 video, set your resolution to 800x600. Also set whatever graphical niceties you want - you don't need to worry about keeping something that gives you a good in-game framerate, but don't go too high or you might find the recording takes an eternity. {{warning|Be aware of hard disk space requirements for long videos. An 800x600 resolution generates approximately 1.5 megabytes for every frame. It's easy to chew through gigabytes very quickly and if you run out of hard disk space, Source will just crash to desktop.}}
# Enter <code>sv_cheats 1</code>, then <code>host_framerate 30</code> into the console, where 30 is the framerate that you want your video to playback at (you might want something else). {{note|Don't forget this step! If you do, your audio will likely not stay in sync with your picture.}}
+
# Enter <code>sv_cheats 1</code>, then <code>host_framerate #</code> into the console, where # is the framerate that you want your video to playback at (you might want something else). {{note|Don't forget this step! If you do, your audio will likely not stay in sync with your picture.}}
 
# Choose a name for your video (it doesn't need to be the same name as the demo file), let's say you've chosen <code>%videoname%</code>.
 
# Choose a name for your video (it doesn't need to be the same name as the demo file), let's say you've chosen <code>%videoname%</code>.
 
# Enter <code>startmovie %videoname%_</code> into the console. (The <code>_</code> underscore on the end of your name is not essential, but useful for later steps.)
 
# Enter <code>startmovie %videoname%_</code> into the console. (The <code>_</code> underscore on the end of your name is not essential, but useful for later steps.)
Line 12: Line 12:
 
# Sit back and grab a beer while it records your demo - it won't necessarily run in real-time. Depending on your machine and on the graphical settings you chose, it might take quite a while. When it's done, the game will return you to the console.
 
# Sit back and grab a beer while it records your demo - it won't necessarily run in real-time. Depending on your machine and on the graphical settings you chose, it might take quite a while. When it's done, the game will return you to the console.
 
# Type <code>endmovie</code> into the console.
 
# Type <code>endmovie</code> into the console.
# Quit the game and browse to the root folder of your mod or game (the one with the <code>gameinfo.txt</code> in it, e.g. <code>Steam/SteamApps/%steamusername%/Half-Life 2/hl2</code> or <code>Steam/SteamApps/SourceMods/metastasis</code>).
+
# Quit the game and browse to the root folder of your mod or game (the one with the <code>gameinfo.txt</code> in it, e.g. <code>Steam/SteamApps/common/Half-Life 2/hl2</code> or <code>Steam/SteamApps/SourceMods/metastasis</code>).
# Here you will find numerous Targa files named <code>%videoname%%framenumber%.tga</code> and a Wave file named <code>%videoname%.wav</code>. Now you need to take these frames and the audio and turn them into a complete video, using the external video creation application of your choice, be it {{Wiki|VirtualDubMod}} (free, but poor UI) or Adobe Premiere or whatever. {{note|It's at this step where the underscore at the end of the videoname becomes useful. If you've recorded two similarly named videos, e.g. <code>lewd_alyx_gmodscene1</code> and <code>lewd_alyx_gmodscene2</code>, it can be difficult to tell when one ends and the other starts when you're just looking at a directory full of hundreds of files named <code>lewd_alyx_gmodscene%somerandomnumber%</code>.}}
+
# Here you will find numerous Targa files named <code>%videoname%%framenumber%.tga</code> and a Wave file by <code>%videoname%.wav</code>. Now you need to take these frames and the audio and turn them into a complete video, using the external video creation application of your choice, be it {{Wiki|VirtualDubMod}} (free, but poor UI) or Adobe Premiere or whatever. {{note|It's at this step where the underscore at the end of the videoname becomes useful. If you've recorded two similarly named videos, e.g. <code>lewd_alyx_gmodscene1</code> and <code>lewd_alyx_gmodscene2</code>, it can be difficult to tell when one ends and the other starts when you're just looking at a directory full of hundreds of files named <code>lewd_alyx_gmodscene%somerandomnumber%</code>.}}
  
 
=== Adobe Premiere ===
 
=== Adobe Premiere ===
Line 30: Line 30:
 
# Now drag your imported footage into the timeline.
 
# Now drag your imported footage into the timeline.
 
# To render it, make sure your timeline is the active window, then go to <code>Composition>Create Movie...</code>, choose a filename, and click <code>Save</code>. A new window called <code>Renderqueue</code> will pop up. Check and tweak the codec settings to get a balance between quality and filesize that you are happy with. Then click <code>Render</code>.
 
# To render it, make sure your timeline is the active window, then go to <code>Composition>Create Movie...</code>, choose a filename, and click <code>Save</code>. A new window called <code>Renderqueue</code> will pop up. Check and tweak the codec settings to get a balance between quality and filesize that you are happy with. Then click <code>Render</code>.
 +
 +
=== FFmpeg ===
 +
{{note|While ffmpeg is available for free on most Linux distros repositories, Windows and macOS versions can be downloaded from [https://ffmpeg.org/download.html ffmpeg download page] which are provided by third parties. [https://chocolatey.org/ Chocolatey] package is also [https://chocolatey.org/packages/ffmpeg available].}}
 +
 +
Run in command line. In this example, we simply import images sequence and audio, and output result to video:
 +
ffmpeg -framerate 30 -i %videoname%_%04d.tga -i %videoname%_.wav %videoname%.mp4
 +
 +
{{note|It's assumed that path to ffmpeg binary for command line is specified in <code>PATH</code> system environment variable, which is likely set by package manager or installer. If you don't have it (check by simply running <code>ffmpeg</code> in commandline), you must either edit PATH variable by appending path to <code>ffmpeg.exe</code>, or specify full path to ffmpeg when launching like <code>C:\Program Files\FFmpeg\bin\ffmpeg.exe</code>}}
 +
{{note|30 is default frame rate for imported images. If you had rendered movie in another frame rate, specify frames per seconds for <code>-framerate</code> command, otherwise you'll get video and audio de-synced.}}
 +
{{note|There are many other options available like specifying another output format with different audio and video codecs, applying filters, etc. Search for tutorials on internet and refer to [https://ffmpeg.org/documentation.html official documentation].}}
  
 
=== Sony Vegas ===
 
=== Sony Vegas ===
Line 54: Line 64:
 
# OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to <code>Video>Filters</code>, and click <code>Add...</code> From the list of filters, select <code>resize</code> and click <code>OK</code>. In the two boxes given, enter the dimensions that you would like your final video to be. In <code>Filter Mode</code>, select <code>Bicubic</code>, and click <code>OK</code>.
 
# OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to <code>Video>Filters</code>, and click <code>Add...</code> From the list of filters, select <code>resize</code> and click <code>OK</code>. In the two boxes given, enter the dimensions that you would like your final video to be. In <code>Filter Mode</code>, select <code>Bicubic</code>, and click <code>OK</code>.
 
# Now that you have set up your video processing, go to <code>File>Save AVI...</code> and choose a save path. When you click <code>OK</code>, VirtualDub will process the TGAs into an AVI file.
 
# Now that you have set up your video processing, go to <code>File>Save AVI...</code> and choose a save path. When you click <code>OK</code>, VirtualDub will process the TGAs into an AVI file.
# OPTIONAL: If you are processing multiple images, check the box marked <code>Don't run this job now...</code> at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to <code>Save AVI</code>, and check the check box again. You can continue doing this until you have all the AVIs qeued up to be processed. Then, press <code>F4</code> to go to <code>Job Control</code>. Click the <code>Start</code> button to process the videos one by one.
+
# OPTIONAL: If you are processing multiple images, check the box marked <code>Don't run this job now...</code> at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to <code>Save AVI</code>, and check the checkbox again. You can continue doing this until you have all the AVIs queued up to be processed. Then, press <code>F4</code> to go to <code>Job Control</code>. Click the <code>Start</code> button to process the videos one by one.
  
 
=== VirtualDubMod ===
 
=== VirtualDubMod ===
Line 66: Line 76:
 
# OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to <code>Video>Filters</code>, and click <code>Add...</code> From the list of filters, select <code>resize</code> and click <code>OK</code>. In the two boxes given, enter the dimensions that you would like your final video to be. In <code>Filter Mode</code>, select <code>Bicubic</code>, and click <code>OK</code>.
 
# OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to <code>Video>Filters</code>, and click <code>Add...</code> From the list of filters, select <code>resize</code> and click <code>OK</code>. In the two boxes given, enter the dimensions that you would like your final video to be. In <code>Filter Mode</code>, select <code>Bicubic</code>, and click <code>OK</code>.
 
# Now that you have set up your video processing, go to <code>File>Save As...</code> and choose a save path. When you click <code>OK</code>, VirtualDub will process the TGAs into an AVI file.
 
# Now that you have set up your video processing, go to <code>File>Save As...</code> and choose a save path. When you click <code>OK</code>, VirtualDub will process the TGAs into an AVI file.
# OPTIONAL: If you are processing multiple images, check the box marked <code>Don't run this job now...</code> at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to <code>Save AVI</code>, and check the check box again. You can continue doing this until you have all the AVIs qeued up to be processed. Then, press <code>F4</code> to go to <code>Job Control</code>. Click the <code>Start</code> button to process the videos one by one.
+
# OPTIONAL: If you are processing multiple images, check the box marked <code>Don't run this job now...</code> at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to <code>Save AVI</code>, and check the check box again. You can continue doing this until you have all the AVIs queued up to be processed. Then, press <code>F4</code> to go to <code>Job Control</code>. Click the <code>Start</code> button to process the videos one by one.
 
 
=== Exporting to AVI ===
 
 
 
Valve has removed AVI support, please export to MOV instead!
 
</nowiki> </code>
 
  
 
== Export to MOV, new with Replay Update for Team Fortress 2 ==
 
== Export to MOV, new with Replay Update for Team Fortress 2 ==
  
 
As of the Replay Update for Team Fortress 2, it is now possible to export to .MOV files. This however, requires QuickTime.
 
As of the Replay Update for Team Fortress 2, it is now possible to export to .MOV files. This however, requires QuickTime.
# Enter "startmovie %videoname%.avi avi ; playdemo %demoname%" (without quotes). Please note the two appearances of "h264" - the first is just the extension of the file, but the second tells the Source engine to record to MOV. There is the second command that launches the demo file that you used for recording. (allows the audio to stay in sync)
+
# Enter "startmovie %videoname% h264; playdemo %demoname%" (without quotes).
 
# At this time, your game will appear to freeze. If you're in full-screen mode, you'll have to Alt-Tab out of the program, then click back in to see the codec selection pop-up window. If you're in windowed mode, you should easily see the window. Choose your MOV codec here - DivX (Recommended) is good if you want to compress the video (archiving, uploading, etc.), whereas a lossless codec like Huffyuv is good if you're planning to edit the video and create a movie (or something similar).
 
# At this time, your game will appear to freeze. If you're in full-screen mode, you'll have to Alt-Tab out of the program, then click back in to see the codec selection pop-up window. If you're in windowed mode, you should easily see the window. Choose your MOV codec here - DivX (Recommended) is good if you want to compress the video (archiving, uploading, etc.), whereas a lossless codec like Huffyuv is good if you're planning to edit the video and create a movie (or something similar).
 
# Once recording is done, browse to the directory mentioned in step 9 and you should find your <code>%videoname%.mov</code> file. That file contains both the video (compressed with your chosen codec) and the audio (in an uncompressed WAV format). If you'd like to use either the video or audio for other purposes, you can easily load this file into any video editor or utility, like VirtualDub.
 
# Once recording is done, browse to the directory mentioned in step 9 and you should find your <code>%videoname%.mov</code> file. That file contains both the video (compressed with your chosen codec) and the audio (in an uncompressed WAV format). If you'd like to use either the video or audio for other purposes, you can easily load this file into any video editor or utility, like VirtualDub.
  
 
== External links ==
 
== External links ==
* [http://www.facepunch.com/threads/1125358 Thread talking about the MOV on Facepunch]
+
* [http://www.facepunch.com/threads/1125358 Thread talking about the MOV format on Facepunch]
 
* [http://www.youtube.com/watch?v=Bmx5vXUfNz4 Video tutorial about recording and exporting demo files]
 
* [http://www.youtube.com/watch?v=Bmx5vXUfNz4 Video tutorial about recording and exporting demo files]
  
 
[[Category:Technical]][[Category:Publicity & Publication]]
 
[[Category:Technical]][[Category:Publicity & Publication]]

Latest revision as of 23:16, 23 June 2020

Once you've recorded your demo, it's likely you'll want to turn it into a video to share with others. Here's different ways to do that:

Exporting to images (jpeg, targa) and .wav files

  1. Load your chosen Source engine game and open the console.
  2. Set your graphics settings to be what you want the video settings to be. E.g. if you want an 800x600 video, set your resolution to 800x600. Also set whatever graphical niceties you want - you don't need to worry about keeping something that gives you a good in-game framerate, but don't go too high or you might find the recording takes an eternity. Warning: Be aware of hard disk space requirements for long videos. An 800x600 resolution generates approximately 1.5 megabytes for every frame. It's easy to chew through gigabytes very quickly and if you run out of hard disk space, Source will just crash to desktop.
  3. Enter sv_cheats 1, then host_framerate # into the console, where # is the framerate that you want your video to playback at (you might want something else).
    Note:Don't forget this step! If you do, your audio will likely not stay in sync with your picture.
  4. Choose a name for your video (it doesn't need to be the same name as the demo file), let's say you've chosen %videoname%.
  5. Enter startmovie %videoname%_ into the console. (The _ underscore on the end of your name is not essential, but useful for later steps.)
  6. Enter playdemo %demoname% into the console, where %demoname% is the name of the demo you want to record.
  7. Sit back and grab a beer while it records your demo - it won't necessarily run in real-time. Depending on your machine and on the graphical settings you chose, it might take quite a while. When it's done, the game will return you to the console.
  8. Type endmovie into the console.
  9. Quit the game and browse to the root folder of your mod or game (the one with the gameinfo.txt in it, e.g. Steam/SteamApps/common/Half-Life 2/hl2 or Steam/SteamApps/SourceMods/metastasis).
  10. Here you will find numerous Targa files named %videoname%%framenumber%.tga and a Wave file by %videoname%.wav. Now you need to take these frames and the audio and turn them into a complete video, using the external video creation application of your choice, be it VirtualDubMod (free, but poor UI) or Adobe Premiere or whatever.
    Note:It's at this step where the underscore at the end of the videoname becomes useful. If you've recorded two similarly named videos, e.g. lewd_alyx_gmodscene1 and lewd_alyx_gmodscene2, it can be difficult to tell when one ends and the other starts when you're just looking at a directory full of hundreds of files named lewd_alyx_gmodscene%somerandomnumber%.

Adobe Premiere

  1. Start a new project and set the project settings to match those you recorded the video in (frame size, pixel ratio, framerate).
  2. Import the audio (File->Import... and browse for %videoname%.wav).
  3. Import the set of frames by selecting the first frame of the video (%videoname%0000.tga) in the same Import window, and checking the "Numbered Stills" checkbox.
  4. Drag the set of frames and the audio onto your timeline, and line them up at zero.
  5. Select File->Export->Movie... to save out your video. Remember to check and tweak the codec settings to get a balance between quality and filesize that you are happy with.

Adobe After Effects

  1. Create a new composition (Composition>New composition... or CTRL+N) and set the composition settings to match those you recorded the video (frame size, pixel ratio, framerate).
  2. In the Project window, rightclick and choose Import>File.... Choose your first frame from your screenshots, and check Targa sequence. Click OK.
  3. To import your audiofile, rightlick in the Project window again, choose Import>File, and select your audiofile. Click OK.
  4. Now drag your imported footage into the timeline.
  5. To render it, make sure your timeline is the active window, then go to Composition>Create Movie..., choose a filename, and click Save. A new window called Renderqueue will pop up. Check and tweak the codec settings to get a balance between quality and filesize that you are happy with. Then click Render.

FFmpeg

Note:While ffmpeg is available for free on most Linux distros repositories, Windows and macOS versions can be downloaded from ffmpeg download page which are provided by third parties. Chocolatey package is also available.

Run in command line. In this example, we simply import images sequence and audio, and output result to video:

ffmpeg -framerate 30 -i %videoname%_%04d.tga -i %videoname%_.wav %videoname%.mp4
Note:It's assumed that path to ffmpeg binary for command line is specified in PATH system environment variable, which is likely set by package manager or installer. If you don't have it (check by simply running ffmpeg in commandline), you must either edit PATH variable by appending path to ffmpeg.exe, or specify full path to ffmpeg when launching like C:\Program Files\FFmpeg\bin\ffmpeg.exe
Note:30 is default frame rate for imported images. If you had rendered movie in another frame rate, specify frames per seconds for -framerate command, otherwise you'll get video and audio de-synced.
Note:There are many other options available like specifying another output format with different audio and video codecs, applying filters, etc. Search for tutorials on internet and refer to official documentation.

Sony Vegas

  1. Open Sony Vegas, then go to File>Properties to set up your project-settings. These should be matching your frames you extracted. Field order should be None (progressive scan) and Deinterlace mode should be None. Click OK.
  2. Now go to File>Import>Media. Browse to the Source game's working directory, such as "C:/Program Files/Valve/Steam/SteamApps/yourusername/Half-Life 2/hl2".
  3. Select the first frame, such as %videoname%_0000.tga. Vegas will take a moment to scan all the frames it can find. Make sure Open still image sequence is checked, and the number of frames is correct in the textbox of range.
  4. Click Open.
  5. A new window called Properties will show up. You can make some settings on your new clip, but leaving everything on default will doing fine.
  6. Click OK to close the Properties window.
  7. You now have a new clip in your Project Media window. Drag'n'drop the new clip into your timeline. Now you can start editing it like a usual movieclip.
  8. To add your soundfile, go to the Explorer window, and find your %videoname%_.wav file. Drag'n'drop your soundfile to your timeline, like you did it with your videoclip.
  9. To render your movie, go to File>Render As.... To render it as DivX, or XviD, choose the filetype as Video for Windows (*.avi), then click Custom. In the new Window make sure you've choosen Best in the Video rendering quality field. In the Video tab, go to Video Format, and choose your preferred videocodec. Now go to the Audio tab, and choose your preferred audiocodec. Clicking OK will close the window. Now you can start the rendering by choosing a filename and clicking Save.

VirtualDub

  1. Open VirtualDub, then go to File>Open. Browse to the Source game's working directory, such as "C:/Program Files/Valve/Steam/SteamApps/yourusername/Half-Life 2/hl2"
  2. Open the first frame, such as %videoname%_0000.tga. VirtualDub will take a moment to load all the frames it can find.
  3. Go to Video>Compression, and choose a compression codec. If you have them, DivX and Xvid are recommended. Xvid generally results in a smaller quality loss, but DivX is smaller and is more popularly used.
  4. Click OK.
  5. Now go to Audio>Wav File... and select %videoname%_.wav.
  6. Go again to the Audio menu and select Full Processing Mode.
  7. Finally, go to Audio>Compression, and choose MPEG Layer 3. (more commonly known as MP3) Choose a compression level. (If you don't need audio for your clip, you can instead go to Audio>No Audio) Click OK.
  8. OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to Video>Filters, and click Add... From the list of filters, select resize and click OK. In the two boxes given, enter the dimensions that you would like your final video to be. In Filter Mode, select Bicubic, and click OK.
  9. Now that you have set up your video processing, go to File>Save AVI... and choose a save path. When you click OK, VirtualDub will process the TGAs into an AVI file.
  10. OPTIONAL: If you are processing multiple images, check the box marked Don't run this job now... at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to Save AVI, and check the checkbox again. You can continue doing this until you have all the AVIs queued up to be processed. Then, press F4 to go to Job Control. Click the Start button to process the videos one by one.

VirtualDubMod

  1. Open VirtualDubMod, then go to File>Open. Browse to the Source game's working directory, such as "C:/Program Files/Valve/Steam/SteamApps/yourusername/Half-Life 2/hl2"
  2. Open the first frame, such as %videoname%_0000.tga. Make sure Automatically load linked segments is checked. VirtualDubMod will take a moment to load all the frames it can find.
  3. Go to Video>Compression, and choose a compression codec. If you have them, DivX and Xvid are recommended. Xvid generally results in a smaller quality loss, but DivX is smaller and is more popularly used.
  4. Click OK.
  5. Now go to Streams>Stream list and click Add. Open your %videoname%_.wav. Now rightclick on your new audiostream in Available streams and choose Full processing mode. Rightclick on your audiostream again, and click Compression to choose your audiocodec.
  6. Click OK to close the Available streams window.
  7. OPTIONAL: You can add a resize filter to your video so the resolution is brought down in the final video. To do this, go to Video>Filters, and click Add... From the list of filters, select resize and click OK. In the two boxes given, enter the dimensions that you would like your final video to be. In Filter Mode, select Bicubic, and click OK.
  8. Now that you have set up your video processing, go to File>Save As... and choose a save path. When you click OK, VirtualDub will process the TGAs into an AVI file.
  9. OPTIONAL: If you are processing multiple images, check the box marked Don't run this job now... at the Save AVI dialog. Then, open your next initial frame and audio file. You do not need to change any settings, as they are kept during a session. Go back to Save AVI, and check the check box again. You can continue doing this until you have all the AVIs queued up to be processed. Then, press F4 to go to Job Control. Click the Start button to process the videos one by one.

Export to MOV, new with Replay Update for Team Fortress 2

As of the Replay Update for Team Fortress 2, it is now possible to export to .MOV files. This however, requires QuickTime.

  1. Enter "startmovie %videoname% h264; playdemo %demoname%" (without quotes).
  2. At this time, your game will appear to freeze. If you're in full-screen mode, you'll have to Alt-Tab out of the program, then click back in to see the codec selection pop-up window. If you're in windowed mode, you should easily see the window. Choose your MOV codec here - DivX (Recommended) is good if you want to compress the video (archiving, uploading, etc.), whereas a lossless codec like Huffyuv is good if you're planning to edit the video and create a movie (or something similar).
  3. Once recording is done, browse to the directory mentioned in step 9 and you should find your %videoname%.mov file. That file contains both the video (compressed with your chosen codec) and the audio (in an uncompressed WAV format). If you'd like to use either the video or audio for other purposes, you can easily load this file into any video editor or utility, like VirtualDub.

External links