Skip to content

Multithreaded, hardware accelerated solution to create high quality movies for the Source engine.

Notifications You must be signed in to change notification settings

xen-000/SourceDemoRender

 
 

Repository files navigation

Source Demo Render

The program can be downloaded here. Visit here if you wish to support the development.

SDR offers the highest possible performance for recording movies by utilizing the GPU and all available threads along with removing speed restrictions within the engine. As opposed to other Source recording methods, SDR integrates itself into the engine and runs from the inside. Frames are kept on the GPU for fast processing. Many frames can be sampled together to form a good motion blur effect.

Is my game supported?

Since games might need special setup, they have to be added manually. You can request your game here or in Discord for it to be added.

Games that are added:

  • Counter-Strike: Source
  • Half-Life 2
  • Half-Life 2: Episode One
  • Half-Life 2: Episode Two
  • Team Fortress 2
  • Momentum
  • Day of Defeat: Source
  • Garry's Mod
  • Black Mesa
  • Half-Life 2 Update

Known games that don't work:

  • Counter-Strike: Global Offensive - Uses stoneage D3D9 that doesn't support texture sharing
  • Portal 2 - Same as above

Prerequisites

Any DirectX 11 (Direct3D 11.0) compatible adapter with minimum of Windows 7 is required. If you wish to not use sdr_video_d3d11_staging, Windows 8.1 or later is required.

Installing

The folder Source Demo Render within the archive can go anywhere you wish. The folder cfg and file sdr_user.cfg are only meant as help to store console variables in for later use. If you choose to use them, they should go in the game directory.

Launching

Launching for users is done with LauncherUI.exe. When adding a new game, you have to specify its game directory along with its executable path. Games are saved and can quickly be selected another time. Updates for the library are automatically checked when launching. The game and extension config files is also automatically updated on every start. If you do not want to update your config files you can create an empty file called LauncherUI_UpdateSkip in the SDR directory or use LauncherCLI.exe directly.

You must run as administrator.

Launcher UI Image 1

Instructions

When you are ready to create your movie just type startmovie <name>.<container> and then endmovie as usual. Do not exit the game until you see a green message that says the movie is completed.

Example of supported video containers:

  • startmovie test.avi
  • startmovie test.mp4
  • startmovie test.mov
  • startmovie test.mkv

The default video encoder is libx264rgb which will produce an RGB video with no color loss. Other available is libx264 for YUV video. Note however that libx264rgb encodes slower than libx264 and will greatly increase file size.

Guide

SDR can output in YUV420, YUV444 and BGR0 formats with x264. For RGB video the color space is RGB. For YUV the color space can be 601 or 709 and the range is full.

Vegas Pro (not recommended)

This video editor cannot open:

  • YUV444 or RGB video - Use YUV420
  • MKV containers - Use MP4
  • AVI containers with YUV video - Use MP4
  • Settings CRF 0 with ultrafast - Use higher CRF or slower preset

If you just use YUV420 you have to use the 709 color space. If you also want to render using x264vfw, you have to set these advanced parameters to not lose any color:

--colormatrix=bt709 --transfer=bt709 --colorprim=bt709 --range=pc

Adobe Premiere

Some versions can open libx264rgb videos which is the recommended way as there are no possibilities of color loss. Some versions can not open either RGB or YUV444 videos.

Extensions

External modules can extend SDR with other functions. The public interface that your module should implement is available at Extension.hpp. Example projects are at Sample Extension, Preview Window, Direct2D Context.

The launcher has a feature to manage all your extensions. In this window you can quickly view, enable or disable, and order your extensions.

Launcher uI Extensions Window 1

Preview Window

This extension will open up a new window which will display how everything looks like at its load order in the video file but in realtime. The window can be resized and the content will remain at its aspect ratio.

Velocity Text

This extension will gather the current player velocity and display it in a highly customizable format.

Velocity Text Image 1

Direct2D Context

This extension creates a rendering context that all other extensions can use without having to recreate it all the time.

Multi Process

This extension will allow you to render with multiple instances of SDR for parallel video creation.

General commands

Name Description
sdr_version Displays the current library version.
sdr_extensions_list Shows information about all loaded extensions.

General variables

Name Description
sdr_outputdir Path where to save the video. The directory structure must exist. This cannot be the root of a drive, it must be a in at least one directory. If this is empty, the output will be in the SDR folder.
sdr_endmovieflash Flash the window when endmovie gets called. This can be used with the demo director to do "endmovie" on a certain tick so you don't have to keep looking at the window.

Values: 0 or 1
Default: 0
sdr_endmoviequit Quits the game after all processing is done.

Values: 0 or 1
Default: 0
sdr_d3d11_debug Enable the Direct3D 11 debug layer. Useful when making extensions that use Direct3D 11 to make sure everything is working correctly.

Values: 0 or 1
Default: 0

Audio variables

Name Description
sdr_audio_only Only process audio. All video variables except sdr_video_fps will be ignored and audio will be processed as fast as possible.

Values: 0 or 1
Default: 0
sdr_audio_disable_video Disable all video processing when audio is being processed.

Values: 0 or 1
Default: 1

Video variables

Name Description
sdr_video_fps Movie output framerate.

Values: 30 to 1000
Default: 60
sdr_video_lav_suppresslog Enable or disable log output from LAV.

Values: 0 or 1
Default: 1
sdr_video_encoder Desired video encoder.

Values: libx264, libx264rgb
Default: libx264rgb
sdr_video_pxformat Encoded pixel format to use.

Values:
Encoder Values
libx264 yuv420, yuv444
libx264rgb bgr0

Default: First listed above per encoder
Read more about YUV
sdr_video_d3d11_staging Use extra intermediate buffer when retreiving data from the GPU.

Values: 0 or 1
Default: 1
sdr_video_x264_crf Constant rate factor quality value. Note that using 0 (lossless) can produce a video with a 4:4:4 profile which your media player might not support.

Values: 0 to 51
Default: 0
Read more
sdr_video_x264_preset Encoding preset. If you can, prefer not to use a slow encoding preset as the encoding may fall behind and the game will have to wait for it to catch up.

Default: ultrafast
Read more
sdr_video_x264_intra Whether to produce a video of only keyframes.

Values: 0 or 1
Default: 1
sdr_video_yuvspace YUV color space. This value is handled differently in media, try experimenting. Not available in RGB video.

Values: 601 or 709
Default: 709
sdr_video_threads How many threads to use for video encoding. If this value is zero, the application will automatically decide how many threads to use.

Values: 0 or higher
Default: 0

Sampling variables

Name Description
sdr_video_sample_mult Value to multiply with sdr_video_fps. This is how many frames will be put together to form a final frame multiplied by exposure. Less than 2 will disable sampling.

Values: Over 0
Default: 32
sdr_video_sample_exposure Fraction of time per frame that is exposed for sampling

Values: 0 to 1
Default: 0.5

Sampling demo

In this demo an object is rotating 6 times per second. This is a fast moving object, so higher sdr_video_sample_mult will remove banding that occurs with lower multiplications at cost of slower recording times. For slower scenes you may get away with a lower multiplication. Exposure is dependant on what type of scene you wish to convey.

The X axis is the multiplication and the Y axis is the exposure.

16 32 64 128
0.25
0.50
0.75
1.00

About

Multithreaded, hardware accelerated solution to create high quality movies for the Source engine.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 88.8%
  • C# 9.2%
  • HLSL 1.8%
  • Batchfile 0.2%