Skip to content

mirv_streams

This command accesses the HLAE / AfxHookSource streams system, which will allow you to set up a stream (or several) to record, as well as making both simple and complex changes to individual streams to suit your needs.

Beginner's section

Advanced section

Supported Games

Counter-Strike: Global Offensive supports the full extent of this feature. Other games or mods based on the Source engine (that HLAE can hook into) are limited to the screen recording feature.

Current Limitations

  • Special materials with special shaders can be problematic (inaccurate)
  • Due to breakage in HLAE replacement shaders with the February 17th 2016 CS:GO update, the streams are much less accurate than they used to be before (meaning on the matte / depths streams as before the big HLAE update smoke won't draw, transparent stuff will be problematic, cables/ropes won't draw and so on).
  • You should only use the default preview slot (meaning only 1 stream in preview), since the multi-stream preview is bugged.

Things you should know

  • The manual doesn't cover all the options available through the mirv_streams command. Basically enter the mirv_streams command or its sub-commands to get help for the current (sub-)command. If the help displays a sub-command with behind it, then you can enter everything in front to get more help for that sub-command. If you mistype anything after mirv_streams, then it will print the most specific (sub-)command help it can find.

CS:GO only

  • You will notice that available sub-commands for are specific to the stream type you are editing. Meaning some streams have different options than others, some have only a few options.
  • You should also follow the advice in the [[smoother demos guide|Source:Smoother-Demos]] to reduce jitter/lag in recordings.

Priming the scene state

(brightness / tonemap / bloom / flares / ...) with a normal stream:

mirv_streams add norm norm
mirv_streams edit norm record 0
mirv_streams mainStream set norm

Examples

Recording other games than CS:GO

This is not recommended for CS:GO, we recommend using the streams system instead (see other examples).

Currently the following games are supported for this option:

  • Alien Swarm
  • CS:GO
  • TF2
  • CSS
  • CSSV34
  • Insurgency2

Further Source 1 games, that alreardy work with HLAE (e.g. mirv_campath), can be added with reasonable effort, feel free to open a feature request and supply us with the materialsystem.dll of that Source 1 game.

For games other than CS:GO (e.g. TF2) the capturing process will only record when the console is closed (just like startmovie, because we detour startmovie for the audio).

Additionally to the host_framerate you will need to set mirv_streams record fps to the same value, because in most games we can not detect the host_framerate value currently.

The example below assumes that you have installed FFMPEG.

host_framerate 1200; mirv_streams record fps 1200; mirv_streams record screen enabled 1; mirv_streams record screen settings afxFfmpegYuv420p; mirv_streams record start // start recording
// ... close console to record a bit ...
mirv_streams record end // stop recording

The mirv_streams record settings command currently allows to set any setting that you can create in CS:GO, including FFMPEG settings and Sampler / motion blur settings.

1. Adding a normal stream

A normal stream is simply a stream that doesn't have many possible settings, you can use it to record the view without special effects.

Enter this in console to add a normal stream named mynormal:

Preview that stream using:

Note: you probably won't see any difference because a normal stream basically looks the same as the base game.

2. Adding a depth stream, previewing it and editing it a bit

To add a depth stream named mydepth enter this:

Now put the stream into preview:

You should be able to see the depth stream now.

Now lets edit the maximum depth value of the stream we added, since the default of 1024 is a bit low:

To check if the value has been set properly enter:

It should display the current value.

3. Adding a matte entity stream and previewing it

Enter this in console to add a matteEntity stream named mymatte:

Preview that stream using:

4. Marking streams as do not record or record

Streams will be recorded by default.

Enter this in console to mark a stream named mymatte as do not record:

This will cause the stream to not be recorded when using

If you want to check that the setting has been applied, enter:
It should display the current value.

5. Stop previewing a stream

To stop previewing a stream there are two ways:
or

6. A more complete example

First lets remove the streams from the previous examples (you can skip that if you didn't add them):


Now let's add a few streams named ent (contains the entities and the world is masked), wrld (contains everything masked or missing in ent), dent (depth for ent) and dwrld (depth for wrld):





Now for extra fun (let's pretend we hate weapon stickers), let's add a stream without weapon stickers, that we put into preview but don't record:



Recording example:

Here is a complete example how to record the streams set up above:

First let's set the record name to test_rec (default is untitled):

Hint: Alternatively you can set a full folder path:

Now let's record:

... record a bit ...

Now stop the recording:

If everything went well, you should now have the recorded image files and audio file in the folder (except if you set another folder path in the steps above, then they will be there).

How to make baseFx look like a normal stream

Will add a baseFx stream that looks the same as "normal" stream template by default.
This is useful, since a baseFx stream supports more effects than a normal stream.

mirv_streams add baseFx normalBaseFx
mirv_streams edit normalBaseFx doBloomAndToneMapping default
mirv_streams edit normalBaseFx doDepthOfField default

Adding a depth stream with up to 23bit precision (OpenEXR):

The actual accuracy is about 23 bits maximum. Depending on your graphics card and drivers the accuracy can be much lower, however with modern cards and drivers you should be close to the 23 bit maximum accuracy.

The depth value of the OpenEXR files will be between the stream's depthVal and depthValMax. If it's not exactly one of these values, then the depth value can be assumed to be the actual distance in 12/16 = 0.75 inch from the camera. If the value is the minimum value (depthVal), then the distance is depthVal or less. If the value is the maximum value (depthValMax), then the distance is depthValMax or above.

There are two methods to get high precision depth / OpenEXR support:

OpenEXR depth stream - The latest way

mirv_streams add depth depth
mirv_streams edit depth depthVal 7
mirv_streams edit depth depthValMax 8192 // or higher
mirv_streams edit depth drawZ rgb
mirv_streams edit depth drawZMode linear
mirv_streams edit depth captureType depth24

OpenEXR depthF stream

This is broken up to current stable HLAE 2.142.1, but will be fixed in an upcoming release:

Enter the following lines into console to create a high accuracy capture of the (pyramidal) depth stream:

mirv_streams add depth myDepthF
mirv_streams edit myDepthF depthVal 7
mirv_streams edit myDepthF depthValMax 8192 // or higher
mirv_streams edit myDepthF drawZ gray // currently has no effect for captureType depthF
mirv_streams edit myDepthF drawZMode pyramidalLinear
mirv_streams edit myDepthF depthValMax 8192.0
mirv_streams edit myDepthF captureType depthF

If you want to have the OpenEXR files with ZIP compression (probably slower), then use instead of .

Quick viewmodel matte

// Quick black and white viewmodel mask:
mirv_streams add depth vmm
mirv_streams edit vmm depthVal 15 // use 7 if you want gray scale
mirv_streams edit vmm depthValMax 15 // note shells ejected are further away, because the game munges the depth of the viewmodel to have it on-top

FFMPEG image stream encoding (to video):

How to install FFMPEG

[zip version] Follow the instructions in ffmpeg/readme.advancedfx.txt in the HLAE folder.

[Setup version] The HLAE installer has an option to install ffmpeg for you.

Example usage (CS:GO)

host_framerate 120
mirv_streams add normal norm
mirv_streams edit norm settings afxFfmpegYuv420p
mirv_streams add depth depth
mirv_streams edit depth settings afxFfmpegLosslessBest
mirv_streams record start
// ...
mirv_streams record end

Hint: You can add custom profiles / see the other default profiles by using the mirv_streams settings command.

Note: Many video programs and browsers can not decode the depth streams, because they are "monochromatic rgb". Also we recommend afxFfmpeg over afxFfmpegYuv420p, both are lossy, but the former has better color quality, while many programs and browsers can only handle the latter.

Sampling System

There is a default 30 down-sampler setting named afxSampler30 in afxSettings. If you want to change settings (e.g. output fps, please add a new sampler using mirv_streams settings add [...] and edit that one.

Example usage (CS:GO)

mirv_streams settings edit afxSampler30 settings afxClassic // if you have FFMPEG installed for HLAE, you can use one of those settings (e.g. afxFfmpegYuv420p) instead of afxClassic
mirv_streams settings edit afxDefault settings afxSampler30
mirv_streams add normal myNorm

// Start recording:
host_framerate 1200; mirv_streams record start

// End recording:
mirv_streams record end; host_framerate 0

Stream properties reference list

These are all the stream properties that can be edited with mirv_streams edit <streamName> including their possible values / parameters. A value of -1 or default uses the default engine setting.

RenderView properties

attachCommands [...] // commands executed before the stream is rendered, some may only work with mat_queue_mode 0
detachCommands [...] // commands executed after the stream is rendered
drawHud -1|0|1
drawViewModel -1|0|1
forceBuildingCubeMaps 0|1
captureType normal|depth24|depth24ZIP|depthF|depthFZIP
doBloomAndToneMapping default|0|1 // post-processing effects
doDepthOfField default|0|1 // lens blur DoF based on the depth buffer, however it appears to be broken in CS:GO(?)

Record properties

record 0|1 // whether to record the stream or not
settings [...] // output settings, whether to record ffmpeg, sampling or an image sequence

BaseFx properties (these apply to all streams except normal streams!)

Tip: <actionName> can be draw, noDraw, mask or other actions set by mirv_streams actions

picker [...] // accesses the picker tool, see related tutorials below
actionFilter [...] // somewhat related to the picker tool
clientEffectTexturesAction <actionName>
worldTexturesAction <actionName>
skyBoxTexturesAction <actionName>
staticPropTexturesAction <actionName>
cableAction <actionName>
playerModelsAction <actionName>
weaponModelsAction <actionName>
statTrakAction <actionName> // the statTrak counter on weapons
shellModelsAction <actionName>
otherModelsAction <actionName>
decalTexturesAction <actionName>
effectsAction <actionName>
shellParticleAction <actionName>
otherParticleAction <actionName>
stickerAction <actionName> // stickers on weapons
errorMaterialAction <actionName>
otherAction <actionName>
writeZAction <actionName>
devAction [...] // Readonly
otherEngineAction [...] // Readonly
otherSpecialAction [...] // Readonly
clear 0|1
clearBeforeHud none|black|white // renders the stream in the specified colour while keeping the HUD
vguiAction <actionName> // affects the scope overlay and possibly other vgui elements
depthVal <fValue> // adjusts the distance of the depth
depthValMax <fValue> // adjusts the distance of the depth
drawZ none|gray|rgb|dithered // use a special shader to draw the Z-(depth) buffer (does not support the HUD)
drawZMode inverse|linear|logE|pyramidalLinear|pyramidalLogE // mode to use for drawZ
smokeOverlayAlphaFactor <fValue> // multiplier of the smoke overlay effect (not the smoke itself)
shouldForceNoVisOverride 0|1 // overrides the engine visibility check which is useful for wallhack
debugPrint 0|1 // prints debug info in the console
invalidateMap // invalidates the material map

Related tutorials

See also

  • [[Source:Commands]]

Made with ❤️ by Advancedfx