Encoded frames
Encoded video and audio frames an webrtc.RTCRtpScriptTransformer reads and writes, with their metadata.
- class webrtc.models.rtc_encoded_frame.RTCEncodedFrameMetadata(synchronization_source=None, payload_type=None, contributing_sources=None, rtp_timestamp=None, receive_time=None, capture_time=None, sender_capture_time_offset=None, mime_type=None)
The metadata shared by encoded video and audio frames. A member the frame lacks is
None.- Parameters:
synchronization_source (
int, optional) β The SSRC of the RTP stream the frame belongs to.payload_type (
int, optional) β The RTP payload type of the frame.contributing_sources (
listofint, optional) β The CSRCs of the frame.rtp_timestamp (
int, optional) β The RTP timestamp of the frame.receive_time (
float, optional) β For a received frame, when its first packet arrived, in milliseconds since the Unix epoch.capture_time (
float, optional) β When the frame was captured, in milliseconds since the Unix epoch. A received frame uses the clock of the remote peer.sender_capture_time_offset (
float, optional) β For a received frame, the offset between the clock of the capturing system and that of the sender, in milliseconds.mime_type (
str, optional) β The codec of the frame, such as'video/VP8'.
- class webrtc.models.rtc_encoded_frame.RTCEncodedVideoFrameMetadata(synchronization_source=None, payload_type=None, contributing_sources=None, rtp_timestamp=None, receive_time=None, capture_time=None, sender_capture_time_offset=None, mime_type=None, frame_id=None, dependencies=None, width=None, height=None, spatial_index=None, temporal_index=None, timestamp=None)
The metadata of an
RTCEncodedVideoFrame. It adds to the members ofRTCEncodedFrameMetadata.See MDN: RTCEncodedVideoFrame/getMetadata.
- Parameters:
frame_id (
int, optional) β The identifier of the frame, whichdependenciesof later frames refer to.dependencies (
listofint, optional) β Theframe_idvalues of the frames this one depends on.width (
int, optional) β The width of the frame, in pixels.height (
int, optional) β The height of the frame, in pixels.spatial_index (
int, optional) β The spatial layer of the frame.temporal_index (
int, optional) β The temporal layer of the frame.timestamp (
int, optional) β The presentation timestamp of the frame, in microseconds.
- class webrtc.models.rtc_encoded_frame.RTCEncodedAudioFrameMetadata(synchronization_source=None, payload_type=None, contributing_sources=None, rtp_timestamp=None, receive_time=None, capture_time=None, sender_capture_time_offset=None, mime_type=None, sequence_number=None, audio_level=None)
The metadata of an
RTCEncodedAudioFrame. It adds to the members ofRTCEncodedFrameMetadata.
- class webrtc.models.rtc_encoded_frame.RTCEncodedVideoFrameOptions(metadata=None)
The options for copying an
RTCEncodedVideoFrame.See MDN: RTCEncodedVideoFrame/RTCEncodedVideoFrame.
- Parameters:
metadata (
RTCEncodedVideoFrameMetadata, optional) β Metadata for the copy. Each member that isnβtNonereplaces that of the original frame.
- class webrtc.models.rtc_encoded_frame.RTCEncodedAudioFrameOptions(metadata=None)
The options for copying an
RTCEncodedAudioFrame.See MDN: RTCEncodedAudioFrame/RTCEncodedAudioFrame.
- Parameters:
metadata (
RTCEncodedAudioFrameMetadata, optional) β Metadata for the copy. Each member that isnβtNonereplaces that of the original frame.
- class webrtc.models.rtc_encoded_frame.RTCEncodedVideoFrame(original_frame, options=None)
An encoded video frame, read from an
webrtc.RTCRtpScriptTransformerand written back to it.The constructor copies a frame with its payload and metadata. A copy belongs to no sender or receiver, so writing it to a transformer drops it.
See MDN: RTCEncodedVideoFrame.
- Parameters:
original_frame (
RTCEncodedVideoFrame) β The frame to copy.options (
RTCEncodedVideoFrameOptions, optional) β Metadata overriding that of the original.
- Raises:
TypeError β If
original_frameisnβt anRTCEncodedVideoFrame.webrtc.DataCloneError β If
original_framewas written.
- property type: EncodedVideoChunkType
Whether itβs a key frame or a delta frame.
- get_metadata()
Returns the metadata of the frame.
See MDN: RTCEncodedVideoFrame/getMetadata.
- Returns:
RTCEncodedVideoFrameMetadataβ A copy, so changing it doesnβt change the frame.- Return type:
- class webrtc.models.rtc_encoded_frame.RTCEncodedAudioFrame(original_frame, options=None)
An encoded audio frame, read from an
webrtc.RTCRtpScriptTransformerand written back to it.The constructor copies a frame with its payload and metadata. A copy belongs to no sender or receiver, so writing it to a transformer drops it.
See MDN: RTCEncodedAudioFrame.
- Parameters:
original_frame (
RTCEncodedAudioFrame) β The frame to copy.options (
RTCEncodedAudioFrameOptions, optional) β Metadata overriding that of the original.
- Raises:
TypeError β If
original_frameisnβt anRTCEncodedAudioFrame.webrtc.DataCloneError β If
original_framewas written.
- get_metadata()
Returns the metadata of the frame.
See MDN: RTCEncodedAudioFrame/getMetadata.
- Returns:
RTCEncodedAudioFrameMetadataβ A copy, so changing it doesnβt change the frame.- Return type: