- 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 320×240, 400×300, 512×384, 640×480, 800×600, 1024×768, 1280×720, 1920×1080 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 320×240 (the SDK’s default), the SDK will select a 320×240 resolution if available. If not, it will opt for the nearest supported resolution, like 400×300. 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()
|