Source Video Creation

Once you've recorded your demo(s), it's likely you'll want to turn it into a video to share with others. This guide will cover everything that you need to know in order to make a clean and smooth speedrun video. Make sure you check the "See Also" links before getting to capturing/editing.

Contents

In-game capture tool

In Source Engine, there's no need to use any external tools such as HLAE in order to do high-quality demo captures. Source games have an included feature in-game which can do the same thing (although broken in older versions). Here's how you capture demos with it:

Configuration

First of all, set your in-game graphics to highest and set the desired resolution (1280x720 for 720p, 1920x1080 for 1080p).

If you want to easily achieve smooth segment transitions and continuous feel, disable HDR and Color Correction (optional but might be needed for some games/mods) to avoid lightning/color changes on each segment change. Please note that in most cases it greatly reduces the nice-looking-ness of the game.

Source Engine seems to play a specific sound on each demo start. In Half-Life 2, it's the ammunition pick up sound. It's best that you replace this soundfile (sound\items\ammo_pickup.wav) with a muted soundfile, so it isn't heard on each segment start.

demo_interplimit - Your demos might be twitchy during playback (due to high speed or something), set this command to a high value, such as 999999999.

host_framerate - This will set the fps of your video. Use 30 for YouTube and higher values (like 60) if you want to make your video downloadable (60 fps is just for viewing pleasure as 30 fps might be too choppy).

Capturing

Once you're set with all the commands and graphics configuration, you can start the demo capturing.

In console, enter startmovie videoname_

Enter playdemo demoname - the capturing starts automatically as the demo playbacks. 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.

Enter endmovie to stop capturing.

Navigate to the root folder of your game (e.g. Steam/SteamApps/common/Half-Life 2/hl2).

Here you will find numerous Targa files named videoname_<framenumber>.tga and a Wave file named videoname_.wav.

Editing

Now that you've captured all the footage, you'll need to turn it into a video file. Use a software such as Sony Vegas or Adobe Premiere to achieve the best results.

Start a new project and set the project settings to match those you recorded the video in (frame size, pixel ratio, framerate).

Import the frames and audio. For the video, choose the first frame of a segment and check "Numbered Stills" (Premiere) or "Open still image sequence" (Vegas), then Import.

Drag the set of frames and the audio onto your timeline, and line them up at zero.

(Vegas only) Make sure you disable the Smart Resampling on each frameset (Right click on video, Properties -> Disable Resample)

The in-game capture feature isn't perfect (though it's still the best option), so now you need to make some adjustments with the video.

By default, the audio is just a bit off-sync, you need to move it 0.1s forward (to the right), so 3 frames forward for 30 fps, 6 frames for 60, 12 for 120 and so on).

Fixing the transitions

You can probably see that the very beginning of the video is jumpy for some reason. This is what we call broken frames and one way to fix that is to stop demo recording using a bind that records a couple of additional frames which can be later overlapped on top of these broken frames.

Again, the amount of these broken frames depend on framerate, and you need to cut them out. For 60 fps captures, it's usually 5-6 frames (or in some cases 10 and more, you'll see when the view makes a jump to normal viewangle). Do this with each segment's frame set and place the extra footage from the previous demo (if you used the save bind) instead of the broken frames. This will ensure that you have smooth segment transitions.

If you had HDR and/or Color Correction enabled, you may notice that in the beginning of each segment the video goes from darker to the normal color. This transition takes approximately 1.5 seconds and you can fix it with Brightness/Contrast adjustment (keyframing from some values to zeros), and, in worse cases, color correction (the video editor one).

Once you're done putting everything up together and fixing the segment transitions, you can now add other stuff into your speedrun video (add missing ammo pickup sounds, making all sounds from previous segment play out, place runner nicknames (if it's a team run) and so on).

Rendering/Encoding

When you're done editing the speedrun video, now it's time to render/encode it.
Tweak the bitrate/codec settings until you're satsified with the quality/filesize. It's best to use the H.264 video codec with CRF (constant rate factor) encoding set to about 19 for the final renders. CRF is a two-pass encoding which gives more quality to the static picture (the eye can focus on the detail) and less quality to the fast-moving parts (where the eye cannot focus well), which results in an equal quality for the viewer.

Never use single-pass bitrate mode

When encoding your run, never use single-pass bitrate mode. Two-pass bitrate mode is preferred because the first pass analyzes the video, seeing which parts need more bits to look good and which parts need less while still looking good. The second pass does the actual encoding. So you see, single-pass bitrate mode will produce sub-par quality because it encodes the video blindly.

Do not confuse single-pass bitrate with single-pass quantizer mode. While the former should never be used, the latter is a valid option and is sometimes used by folks at SDA. Don't worry about it though, the guides will always recommend that you use two-pass bitrate mode.