Table of Contents

Method SetVideoSettingsAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetVideoSettingsAsync((int Width, int Height)?, (int Width, int Height)?, (int Numerator, int Denominator)?, CancellationToken)

Changes the video settings of OBS Studio (the profile that is current), and returns when OBS Studio has made the change.

public Task SetVideoSettingsAsync((int Width, int Height)? baseResolution = null, (int Width, int Height)? outputResolution = null, (int Numerator, int Denominator)? frameRate = null, CancellationToken cancellationToken = default)

Parameters

baseResolution (int Width, int Height)?

The base (canvas) resolution in pixels, the size of what the scenes are drawn on: its width and its height; or null to leave it as it is.

outputResolution (int Width, int Height)?

The output resolution in pixels, the size of what is streamed and recorded: its width and its height; or null to leave it as it is.

frameRate (int Width, int Height)?

The frame rate as a fraction, so that 59.94 frames per second can be said exactly: the numerator and the denominator (60000 and 1001); or null to leave it as it is.

cancellationToken CancellationToken

A token that ends the wait. A change that was not sent yet is not sent.

Returns

Task

A task that completes when OBS Studio has answered that it made the change.

Remarks

The width and the height of a resolution, and the numerator and the denominator of the frame rate, go together: a call that gives one of a pair gives both. All that is given is changed with one request, so OBS Studio resets its video once. OBS Studio refuses the change while an output is active (obs-websocket answers OutputRunning with "Video settings cannot be changed while an output is active."; measured while recording): stop the output first. It takes the sizes from 1 to 4096 as obs-websocket documents them, and in its source (obs-websocket 5.7.6) the smallest size that it accepts is 8.

OBS Studio does not announce a change of the video settings and the model does not keep them, so the call has nothing to wait for but the answer of OBS Studio: ask what it holds with GetVideoSettingsAsync(CancellationToken). The settings belong to the profile that is current when the request is made. See SetEnabledAsync(bool, CancellationToken) for the order of changes.

Exceptions

ArgumentException

None of the three is given.

ArgumentOutOfRangeException

A size is not from 1 to 4096, or a part of the frame rate is less than 1.

ObsNotConnectedException

There is no connection to OBS Studio. Nothing was changed.

ObsNotReadyException

OBS Studio is changing its scene collection, or did so after the call. Nothing was changed.

ObsUnknownOutcomeException

OBS Studio did not answer in time, or the connection ended: it is not known whether it made the change.

ObsResponseException

OBS Studio refused the change: an output is active (ErrorCode is OutputRunning), or it does not take the values (RequestFieldOutOfRange).