Recorder Options

TFBRecorder Options

 

Profiles

Profiles make it easy to set commonly used options. Read about profiles.

 

Advanced Options Setting

To have full control over options, use GetConfigJSONForProfile or GetDefaultConfigJSON to fetch the JSON object for a particular profile, modify parameters in the object, then use SetConfigJSON to pass it to a Recorder instance to use those options.

Methods for reading and setting options

ActivateProfile
GetConfigJSONForProfile
GetDefaultConfigJSON
SetConfigJSON

Properties in the Settings Object

Video Capture Devices
SelectedVideoCaptureDevices
AvailableVideoCaptureDevices
RecordWebcamToTrack
RecordMonitorsToTracks
RecordScreen
Video Encoder
SelectedVideoEncoder
AvailableVideoEncoders
VideoEncoderParameters
Region
OutputSize
Region
WindowHandles
Watermark
Watermarks
Cursor
RecordMouseCursor
RecordMouseCursorAsTrack
 
Misc
CaptureMode
GraphicsEngine
Audio
AudioSettings
CreateTrackPerAudioOutput

 

Video Capture Devices

These properties set options on webcams or similar camera devices attached to the PC. 

SelectedVideoCaptureDevices

Specifies the video devices to be recorded and which of their streams and stream formats are to be captured.

Specifies the position and size of the captured video in the output video file. 

To select a device, stream and format, read their indexes from AvailableVideoCaptureDevices and set them in SelectedVideoCaptureDevices.

SelectedVideoCaptureDevicesList of

DeviceIndexint This is the index of the device in AvailableVideoCaptureDevices
DeviceStreamIndexint The index of the device stream to record in AvailableVideoCaptureDevices
DeviceFormatIndexint The index of the stream format to record in AvailableVideoCaptureDevices
DrawAtXint The X pixel position to render the captured video, in the recorded video file, if RecordWebcamToTrack is False
DrawAtYint The Y pixel position to render the captured video, in the recorded video file, if RecordWebcamToTrack is False
FiltersList of
NameString Currently only one filter type is available, to resize the captured video.
The Name must be set to “ResizeFilter”
Widthint Width in pixels that the video will be resized to
Heightint Height in pixels that the video will be resized to


Usage:


// get the settings object
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// Select a webcam for recording
// deviceIndex = the index of a device in AvailableVideoCaptureDevices
// deviceStreamIndex = the index of a stream in the settings['AvailableVideoCaptureDevices'][deviceIndex] array
// deviceFormatIndex = the index of a format in the settings['availableVideoCaptureDevices'][deviceIndex]['Streams'][deviceStreamIndex]['Formats'] array
//
settings['SelectedVideoCaptureDevices'][0]["DeviceIndex"] = deviceIndex; 
settings['SelectedVideoCaptureDevices'][0]["DeviceStreamIndex"] = deviceStreamIndex;
settings['SelectedVideoCaptureDevices'][0]["DeviceFormatIndex"] = deviceFormatIndex;
settings['SelectedVideoCaptureDevices'][0]["DrawAtX"] = 0;
settings['SelectedVideoCaptureDevices'][0]["DrawAtY"] = 0;

 

AvailableVideoCaptureDevices

Contains a list of the available video capture devices. These are generally webcams or similar attached cameras.

To select a device for recording, pass its index, and the index of the required Stream and Format to the SelectedVideoCaptureDevices parameter.

AvailableVideoCaptureDevicesList of

FriendlyNameString The friendly name is suitable for showing to the user but may not be unique.
Note: all strings in the settings object use UTF-8 encoding.
SymbolicNameString The symbolic name uniquely identifies the device on the PC but is not user-readable.
StreamsList of

UniqueStreamIdInt A unique identifier for the stream.
A device can have more than one stream, for example front and rear cameras.
MajorTypeString This needs to be “MFMediaType_Video” for the stream to be selected in SelectedVideoCaptureDevices
FormatsList of

WidthInt Width of the video in pixels
HeightInt Height of the video in pixels
MajorTypeNameString This needs to be “MFMediaType_Video” for the stream format to be selected in SelectedVideoCaptureDevices
SubTypeNameString This needs to be “MFVideoFormat_YUY2” or “MFVideoFormat_NV12” for the stream format to be selected in SelectedVideoCaptureDevices

 

Usage:



// Get the settings
defaultConfig = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// iterate through and print the available video capture devices
int iVideoCaptureDevices = 0;

if (defaultConfig["AvailableVideoCaptureDevices"] != null)
  iVideoCaptureDevices = defaultConfig["AvailableVideoCaptureDevices"].Count;

Console.WriteLine(String.Format("Available video capture devices ({0}):", iVideoCaptureDevices));

for (int i = 0; i < iVideoCaptureDevices; i++)
{
  Console.WriteLine(String.Format("{0}: {1}", i + 1,
  defaultConfig["AvailableVideoCaptureDevices"][i]["FriendlyName"]));
}


// select a capture device for recording
defaultConfig["SelectedVideoCaptureDevices"][0]["DeviceIndex"] = i32DeviceIndex; // the index in the ["AvailableVideoCaptureDevices"] array
defaultConfig["SelectedVideoCaptureDevices"][0]["DeviceStreamIndex"] = i32DeviceStreamIndex; // the index in the ["AvailableVideoCaptureDevices"][i32DeviceIndex]["Streams"] array
defaultConfig["SelectedVideoCaptureDevices"][0]["DeviceFormatIndex"] = i32DeviceFormatIndex; // the index in the ["AvailableVideoCaptureDevices"][i32DeviceIndex]["Streams"][DeviceStreamIndex]["Formats"] array
defaultConfig["SelectedVideoCaptureDevices"][0]["DrawAtX"] = 0;
defaultConfig["SelectedVideoCaptureDevices"][0]["DrawAtY"] = 0;

// and pass these options to the recorder
pRecorder.SetConfigJSON(defaultConfig);

 

RecordWebcamToTrack

Set this to true to record webcam to a separate video track in the MP4 file. The dimensions of the track will be the dimensions of the format selected in SelectedVideoCaptureDevices.

Set to false to record webcam output into the screen recording image. The size and position of the webcam image will be set by SelectedVideoCaptureDevices->DrawAtX, SelectedVideoCaptureDevices->DrawAtY and SelectedVideoCaptureDevices->Filters->Width/Height.

Defaults to false.

RecordWebcamToTrackboolean True = record webcam to a separate video track in the MP4 file.

False = record webcam output into the screen recording image.

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["RecordWebcamToTrack"] = True;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

RecordMonitorsToTracks

When set to True, creates a separate video track in the MP4 file for each monitor. By default all monitors recorded will be combined into one video track.

RecordMonitorsToTracksBoolean True = create a separate video track for each monitor recorded
False = combine all monitors into one video track

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["RecordMonitorsToTracks"] = True;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

RecordScreen

Set this to true to record the screen. Set to false to record only from a video device (usually webcam).

Defaults to true.

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["RecordScreen"] = False;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Video Encoder Options

FlashBack SDK uses a video encoder to encode the captured video to H264 in an MP4 container. 

SelectedVideoEncoder

Specifies the encoder used to encode the video stream. Both the Name and Type values have to be set in this parameter, read from the encoders listed in AvailableVideoEncoders.

The video encoder defaults to the Microsoft Media Foundation h264 encoder, which should be available on Windows 7 and later.

Namestring This is the name of the encoder in AvailableVideoEncoders
Typeint The type of the encoder in AvailableVideoEncoders

 

Usage:

settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);<br />
// encoderIndex = index in AvailableVideoEncoders of the encoder to select
settings['SelectedVideoEncoder']['Name'] = settings['AvailableVideoEncoders'][encoderIndex]['Name'];
settings['SelectedVideoEncoder']['Type'] = settings['AvailableVideoEncoders'][encoderIndex]['Type'];

 

AvailableVideoEncoders

Lists the video encoders available.

To select an encoder for recording, pass its Name and Type values into the SelectedVideoEncoder parameter.

AvailableVideoEncodersList of

NameString The name is suitable for display to the user but may not be unique.
Note: strings in the settings object use UTF-8 encoding.
TypeInteger Software = 0
Intel hardware = 1
NVidia hardware = 2
AMD hardware = 3
HardwareBoolean Set to true for hardware encoders, false for software.

 

Usage:



// Get the settings
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// iterate through and print the available video encoders
int iVideoEncoders = 0;

if (settings["AvailableVideoEncoders"] != null)
  iVideoEncoders = settings["AvailableVideoEncoders"].Count;

Console.WriteLine(String.Format("Available video encoders ({0}):", iVideoEncoders));

for (int i = 0; i < iVideoEncoders; i++) {
  Console.WriteLine(String.Format("{0}: {1}", i + 1,
  settings["AvailableVideoEncoders"][i]["Name"]));
}

// select an encoder. Its index is iEncoderIndex
settings["SelectedVideoEncoder"]["Name"] = settings["AvailableVideoEncoders"][iEncoderIndex]["Name"];
settings["SelectedVideoEncoder"]["Type"] = settings["AvailableVideoEncoders"][iEncoderIndex]["Type"];

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

VideoEncoderParameters

Sets options for the selected video encoder.

H264profileint Sets the H264 profile used:
Simple = 66
Base = 66
Main = 77
High = 100
_422 = 122
High10 = 110
_444 = 144
Extended = 88

// UVC 1.2 H.264 extension
ScalableBase = 83
ScalableHigh = 86
MultiviewHigh = 118
StereoHigh = 128
ConstrainedBase = 256
UCConstrainedHigh = 257
UCScalableConstrainedBase = 258
UCScalableConstrainedHigh = 259
Default = 77 (BBEncoders::TH264Profiles::Main)
CompressionModeint Sets whether the video is encoded to a specified bitrate or quality.
0 = bitrate
1 = quality
Default = 1 (BBEncoders::TFBBitrateQualityMode::quality)
Note: currently bitrate mode is not used. CompressionMode should only be set to 1.
QualityLevelint Sets the quality level. Takes values from 1-100. Only used when CompressionMode = 1
Default = 80
FPS
Numint FPS numerator.
Defaults = 15.
Denint FPS denominator. Defaults to 1.
e.g. to set 20fps, set [‘FPS’][‘Num’] = 20 and [‘FPS’][‘Den’] = 1
To set an FPS lower than 1, for example to record a frame once every 2 seconds, set [‘FPS’][‘Num’] = 1 and [‘FPS’][‘Den’] = 2
GOPSizeint Sets the frequency of keyframes. More keyframes gives better quality but requires a higher bitrate and creates larger files.

The GOP (Group of Pictures) value sets the maximum number of frames between keyframes. It is usual to have one keyframe every 1-2 seconds. You can set a higher GOP value to have less keyframes – this will increase compression but may make the video file difficult to seek through.

Default = 60

BFramesNumint This defaults to the recommended value: 2. It can be increased to increase the compression ratio, but this will result in higher CPU usage.
RefFramesNumint Generally, more reference frames means better compression but higher CPU usage. The number of reference frames cannot be higher than that allowed by the H264 profile. It is recommended to keep this value between 2 and 4.
Default = 2
EnableCabacboolean Set to True to enable Cabac encoding, which gives better quality at the expense of higher CPU usage when decoding.
Default = false
LowLatencyboolean Not currently used – for future features. Do not change from default. 
Default = false

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["VideoEncoderParameters"]["FPS"]["Num"] = 10; // 10 frames per second
settings["VideoEncoderParameters"]["H264Profile"] = BBEncoders::TH264Profiles::Baseline; // higher performance
settings["VideoEncoderParameters"]["Quality"] = 90; // high quality

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Misc

CaptureMode

Sets the method of capturing the screen. Modern PCs, using Windows 8.1 or newer should use DuplicationAPI. GDI mode is included for compatibility with older PCs.

CaptureModeint Unknown = 0,
GDI = 1,
DuplicationAPI = 2

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// ensure compatibility with older PCs
settings["CaptureMode"] = 1;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

GraphicsEngine

Sets the graphics engine used for rendering video. Defaults to D3D9 but can be set to D3D11 to improve performance or to CPU if problems are experienced with D3D9.

GraphicsEngineint CPU = 1 (slowest),
D3D9 = 2 (default),
D3D11 = 3 (best performance)

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// improve performance on newer PCs
settings["GraphicsEngine"] = 3;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Region Options

OutputSize

Sets the size of the MP4 video file produced. If not set, the dimensions default to the size of the recorded region.

OutputSize
Widthint Width in pixels of the output MP4
Heightint Height in pixels of the output MP4. The actual output will be rounded up to a multiple of 4

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// set the recording region
settings["OutputSize"]["Width"] = 800;
settings["OutputSize"]["Height"] = 600;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Region

Defines the size and position of the region to be recorded. By default this will be set to the entire primary monitor.

Region
Leftint Left position of the region, in pixels. Can be negative.
Topint Top position of the region, in pixels. Can be negative.
Widthint Width in pixels of the region
Heightint Height in pixels of the region

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// record a region 100px X 100px with the top corner 300px from the top and left 
settings["Region"]["Top"] = 300;
settings["Region"]["Left"] = 300;
settings["Region"]["Width"] = 100;
settings["Region"]["Height"] = 100;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

WindowHandles

Selects windows to record. By setting the WindowHandles property, FBRecorder is put into Window recording mode. The entire region specified by the Region property is recorded but areas outside the specified windows are black – only the windows are recorded. The WindowHandles property should be set to an array of top-level window handles.

WindowHandles Array of window handles.

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

// We will just record these 2 windows. Everything outside them will be black. We're not setting Region, so only the primary monitor will be recorded
settings["WindowHandles"][0] = 0x003F1B38;
settings["WindowHandles"][1] = hwndSomeWindow;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Cursor Options

RecordCursor

When set to True, records the mouse cursor when recording the screen.

Defaults to True.

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["RecordCursor"] = False;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

RecordCursorToTrack

When set to True, creates a separate video track in the MP4 file for the cursor. This track will have the same dimensions as the screen recording track but will contain only the cursor image.

Defaults to False.

 

Usage:

// get the options for the HIGH_SCREEN profile
settings = pRecorder.GetConfigJSONForProfile(HIGH_SCREEN);

settings["RecordCursorToTrack"] = True;

// and pass these options to the recorder
pRecorder.SetConfigJSON(settings);

 

Watermarks

Watermarks

Sets images to be added as watermarks to the recording.

WatermarksList of:

Widthint Width in pixels to draw the watermark.
Heightint Height in pixels to draw the watermark.
DstWidthint Width in pixels to draw the —
DstHeightint
DrawAtXint
DrawAtYint
BeforeResizeint
Typeint If Type=”Frames” then Watermarks contains an additional property: Frames
Framesarray of  
Delayint The frame delay, in milliseconds.
FrameHexStringstring RGB32 image encoded as hex text
  If Type=”GIF” then Watermarks contains an additional property: ImageData
ImageDatastring GIF binary data encoded as hex text

 

Usage:


//
// Sample code to use a PNG file, loaded from application resources, as a watermark.
//
static bool LoadPngAsWatermark(JObject pWatermark)
{
  bool bResult = false;
  System.Drawing.Bitmap pPngImage = null;

  try
  {
    System.Reflection.Assembly pAssembly = System.Reflection.Assembly.GetExecutingAssembly();
    string sResourcePath = pAssembly.GetName().Name + ".Properties.Resources";
    var pResourceManager = new System.Resources.ResourceManager(sResourcePath, pAssembly);

    pPngImage = (System.Drawing.Bitmap)pResourceManager.GetObject("explosion");
    pWatermark["Width"] = pPngImage.Width;
    pWatermark["Height"] = pPngImage.Height;
    pWatermark["DstWidth"] = pPngImage.Width;
    pWatermark["DstHeight"] = pPngImage.Height;
    pWatermark["DrawAtX"] = 400;
    pWatermark["DrawAtY"] = 400;
    pWatermark["BeforeResize"] = true;
    pWatermark["Type"] = "Frames";

    var aFrames = new JArray();
    pWatermark["Frames"] = aFrames;

    aFrames.Add(new JObject());
    var aFrame = aFrames[0];
    aFrame["Delay"] = 10000;

    string sHexImage = "";
    for (int y = 0; y < pPngImage.Height; y++)
    {
      for (int x = 0; x < pPngImage.Width; x++)
      {
        Color pixelColor = pPngImage.GetPixel(x, y);
        sHexImage += pixelColor.R.ToString("x2");
        sHexImage += pixelColor.G.ToString("x2");
        sHexImage += pixelColor.B.ToString("x2");
        sHexImage += pixelColor.A.ToString("x2");
      }
    }

                aFrame["FrameHexString"] = sHexImage;

                bResult = true;

            }

            catch (Exception exp)

            {

                Console.WriteLine("Error: LoadGifAsWatermark exception: " + exp.Message);

            }

            if (pPngImage != null)

                pPngImage.Dispose();

            return bResult;

        }

 

Audio Options

AudioSettings

Contains the available audio sources and the sources selected for recording.

Audio is recorded in AAC format, 2 channel (stereo), 44.1Khz sampling rate, 128kbits/sec bitrate.

SelectedAudioSources List of Ids of devices to be recorded.
List of

DeviceIdstring Id of an audio device, as read from AudioSettings:AvailableAudioSources
 
AvailableAudioSources List of audio sources available for recording.
List of

Defaultboolean Specifies whether the source is recorded by default.
DeviceIdstring Unique device Id
Namestring Displayable name of the device.
Note: strings in the settings objects use UTF-8 encoding.
Typeint Specifies whether the device is for output (headset, speakers) or input (microphone)
0 = Unknown
1 = Microphone
2 = Output
3 = ASIO
TypeDescrstring Typically this is set to “Unknown = 0, Capture (microphone) = 1, Render (output) = 2, ASIO = 3”
 
AvailableAACEncoders List of AAC encoders.
List of:

NameString The name is suitable for display to the user but may not be unique.
Note: strings in the settings object use UTF-8 encoding.
TypeInteger Unknown = 0
Microsoft = 1

 

Example:


"AudioSettings": {

  "SelectedAudioSources": [
    {"DeviceId": "{0.0.1.00000000}.{51415c15-ee52-4e36-8487-eedc9653f91e}"},
    {"DeviceId": "{0.0.0.00000000}.{d21e9bb4-cd53-44df-b4a2-1b175e265c9f}"}
  ],
  
  "AvailableAudioSources": [
    {
      "Default": true,
      "DeviceId": "{0.0.1.00000000}.{51415c15-ee52-4e36-8487-eedc9653f91e}",
      "Name": "Microphone (Realtek High Definition Audio)",
      "Type": 1,
      "TypeDescr": "Unknown = 0, Capture = 1, Render = 2,\tASIO = 3"
    },
    {
      "Default": false,
      "DeviceId": "{0.0.0.00000000}.{33da9536-b5c9-4346-836f-07889999030c}",
      "Name": "Headset (Logitech USB Headset)",
      "Type": 2,
      "TypeDescr": "Unknown = 0, Capture = 1, Render = 2,\tASIO = 3"
    },
    {
      "Default": true,
      "DeviceId": "{0.0.0.00000000}.{d21e9bb4-cd53-44df-b4a2-1b175e265c9f}",
      "Name": "HeadPhone/Digital Output (Realtek High Definition Audio)",
      "Type": 2,
      "TypeDescr": "Unknown = 0, Capture = 1, Render = 2,\tASIO = 3"
    }
  ],

  "AvailableAACEncoders": [
    {
     "Type": 1,
     "Name": "Microsoft AAC Audio Encoder MFT"
    }
  ],

  "AudioEncoderParameters": -- not used --,
}

 

Usage:

// get a high performance screen-only  profile
settings = fbrecorder.GetConfigJSONProfile(HIGH_SCREEN);

// get the first audio source
var aAudioSources = new JArray();
aAudioSources.Add(settings["AudioSettings"]["AvailableAudioSources"][0]);

// set that as the source to be recorded in the options
settings["AudioSettings"]["SelectedAudioSources"] = aAudioSources;

// and use these options
fbrecorder.SetConfigJSON(settings);

 

CreateTrackPerAudioOutput

Determines whether each audio input (e.g. microphone, PC sounds) is saved to a separate audio track in the MP4 file or are mixed together into one.

By default, inputs are mixed to one track to be compatible with video player software

If inputs are saved to separate tracks, this enables editing of individual tracks but video player software will just play back one track at a time. 

CreateTrackPerAudioOutput
boolean
true = separate tracks created
false = all audio sources mixed to one track