ScnLib_SetWebcamResolution()

ScnLib_SetWebcamResolution()

Std EditionPro EditionMax EditionUltra Edition
C++ __declspec(dllimport) void __stdcall ScnLib_SetWebcamResolution(int nWidth, int nHeight);
C# [DllImport("ScnLib.dll")] public static extern void ScnLib_SetWebcamResolution(int Width, int Height);
Basic Public Declare Sub ScnLib_SetWebcamResolution Lib "ScnLib.dll" (ByVal Width As Int32, ByVal Height As Int32)
Delphi procedure ScnLib_SetWebcamResolution(Width: Integer; Height: Integer); stdcall; external 'ScnLib.dll';
  • Description
    Set the preferred resolution for the webcam.

  • Parameters
    • Width [in]
      The width of the webcam resolution. Set 0 to prompt the SDK to adaptively choose the webcam's resolution.
    • Height [in]
      The height of the webcam resolution. Set 0 to prompt the SDK to adaptively choose the webcam's resolution.
  • Return Value
    None.

  • Remarks
    Use this function to set the preferred resolution for the webcam. Typically, webcams support a variety of resolutions (like 320x240, 400x300, 512x384, 640x480, 800x600, 1024x768, 1280x720, 1920x1080 and etc.), frame rates (like 5fps, 10fps, 15fps, 20fps, 30fps, 60fps and etc.) and frame formats (such as RGB, YUV, MJPEG, H.264, H.265 and etc.). Offering users a choice among these numerous combinations could be overwhelming and potentially lead to a poor experience. Therefore, the SDK simplifies this by automatically selecting an appropriate resolution, fps and frame format combination.

    By default, both Width and Height are set to zero. This prompts the SDK to adaptively choose the webcam's resolution. In this scenario, the SDK picks a resolution closest to or matching the webcam view size. For instance, if the view size is set to 320x240 (the SDK's default), the SDK will select a 320x240 resolution if available. If not, it will opt for the nearest supported resolution, like 400x300. If the recording video frame rate is set to 30fps (the SDK's default), the SDK will select a 30fps frame rate if available. If not, it will opt for the nearest supported frame rate, like 20fps. The SDK prefers the RGB frame format unless better frame formats like MJPEG, H.264, or H.265 are available. The frame format selection priority is MJPEG, H.264, H.265, RGB and YUV.

    If you set a non-zero value for either Width, Height, or both, the SDK interprets this as your preferred resolution and selects the closest supported resolution, regardless of the webcam view size settings. This is particularly useful for creating high-resolution webcam-only videos.

    In webcam-only recording mode, the webcam view size is equivalent to the video image size. For screen recording with webcam overlay mode, the webcam view size can be set using ScnLib_SetWebcamViewSize(). Remember, a higher webcam resolution results in a clearer view but incurs more recording overhead. To check the current actual webcam resolution, call ScnLib_GetWebcamResolution().

  • See Also
    ScnLib_PreviewWebcam()
    ScnLib_GetWebcamResolution()
    ScnLib_SetWebcamViewSize()

Try the SDK for FREE SDK APIs overview