Skip to content

SetVideoCompressionSettings

function

Delphi
function SetVideoCompressionSettings (DataRate: LongInt; KeyFrameRate: LongInt; PFramesPerKeyFrame: LongInt; WindowSize: LongInt; Quality: Double): Boolean;
C++Builder
bool __fastcall SetVideoCompressionSettings(System::LongInt DataRate, System::LongInt KeyFrameRate, System::LongInt PFramesPerKeyFrame, System::LongInt WindowSize, double Quality);
C#
public bool SetVideoCompressionSettings(int DataRate, int KeyFrameRate, int PFramesPerKeyFrame, int WindowSize, double Quality);
VB.NET
Public Function SetVideoCompressionSettings(DataRate As Integer, KeyFrameRate As Integer, PFramesPerKeyFrame As Integer, WindowSize As Integer, Quality As Double) As Boolean
C++/Qt
BOOL SetVideoCompressionSettings (int DataRate, int KeyFrameRate, int PFramesPerKeyFrame, int WindowSize, double Quality);

Assigns the VideoCompression_DataRate, VideoCompression_KeyFrameRate, VideoCompression_PFramesPerKeyFrame, VideoCompression_WindowSize and VideoCompression_Quality properties, applied at the next recording. Returns true.

Same as assigning the properties, except:

  • KeyFrameRate 15 and Quality 1.0 (the default values of the properties) passed to SetVideoCompressionSettings are also applied to the Media Foundation encoder entries of VideoCompressors and to the MP4 recording without video compression (built-in MP4 writer): a key frame every 15 frames, and a constant quality 100 (JPEG quality 100 for the MJPEG entries) unless a DataRate is applied (the data rate takes precedence). When they are assigned to the properties, these default values are not applied to the Media Foundation encoder entries and to the built-in MP4 writer (the properties are saved by the forms and by the .NET designer);

  • Quality above 1: 1.0 (ignored by the property);

  • KeyFrameRate or Quality negative: not applied (the compressor keeps its default value).

A later assignment of VideoCompression_KeyFrameRate or VideoCompression_Quality accepted by the property, or a call to SetVideoCompressionDefaults, restores the rule of the properties.

Parameters:

  • DataRate: data rate in bits per second, -1 = default (see VideoCompression_DataRate).

  • KeyFrameRate: the key-frame rate is the number of frames per key frame. For example, if the rate is 15, a key frame occurs every 15 frames.

  • PFramesPerKeyFrame: P frames are used only in MPEG compression. E.g. if a key frame occurs once every 10 frames and there are three P frames per key frame, the P frames are spaced evenly between the key frames, and the remaining six frames are bidirectional (B) frames.

  • WindowSize: number of frames over which the compressor maintains the average data rate. E.g. with a data rate of 100K/sec and a frame rate of 10 frames per second, if the window size is 1, every frame is 10K or less. If the window size is 5, every five consecutive frames average 10K per frame, but individual frames may exceed this size.

  • Quality: value between 0.0 and 1.0, where 1.0 indicates the best quality and 0.0 the worst quality. If the value is negative, the filter uses the default quality.

The capabilities and the values of the current video compressor can be retrieved by GetVideoCompressionSettings:

  • CanCrunch: the compressor can compress video to a specified data rate (see DataRate above).

  • CanKeyFrame: the compressor supports the KeyFrameRate parameter above.

  • CanBFrame: the compressor supports the PFramesPerKeyFrame parameter above.

  • CanWindow: the compressor supports the WindowSize parameter above.

  • CanQuality: the compressor supports the Quality parameter above.