VideoFrame class represents a single video frame received in video renderer callbacks. It provides access to the raw video buffer and frame metadata.
Class Definition
Properties
buffer
color_format property.
Returns: bytes - Raw video buffer
width
int - Frame width in pixels
height
int - Frame height in pixels
timestamp_us
int - Timestamp in microseconds
color_format
str - Color format string
Usage in Video Renderers
VideoFrame objects are received in video renderer callbacks that you set with set_video_renderer().
Example: Basic Video Renderer
Example: Saving Frames as Images
Example: Processing Video with OpenCV
Example: Real-time Video Display
Color Formats
Thecolor_format property indicates how the pixel data is arranged in the buffer:
- RGBA: 4 bytes per pixel (Red, Green, Blue, Alpha)
- RGB: 3 bytes per pixel (Red, Green, Blue)
- I420: Planar YUV format (Y plane, then U and V planes)
Buffer Size Calculation
For RGBA format:Notes
VideoFrameobjects are read-only and provided by the SDK- Video frames are delivered continuously while the video renderer is active
- The frame rate depends on the participant’s video stream
- Large video buffers may impact memory usage - process or discard frames promptly
- The
timestamp_uscan be used to synchronize video with audio or other streams
See Also
- CallClient.set_video_renderer() - Set up video renderer callbacks
- AudioData - Audio frame data for audio renderers
- VirtualCameraDevice - Send custom video to a call