5.2.12. ytpb.segment¶
Media segments and their metadata.
- class ytpb.segment.SegmentMetadata(sequence_number: int, ingestion_walltime: float, ingestion_uncertainty: float, target_duration: float, first_frame_time: float, first_frame_uncertainty: float, stream_duration: float = None, max_dvr_duration: float = None, streamable: str | None = None, encoding_alias: str | None = None)¶
Bases:
objectRepresents the YouTube segment metadata.
All timestamp and time-related values are in seconds.
- class ytpb.segment.Segment¶
Bases:
objectA media segment.
- property ingestion_start_date: datetime¶
A segment ingestion start date.
Corresponds to the Ingestion-Walltime-Us value.
- property ingestion_end_date: datetime¶
A segment ingestion end date.
Corresponds to the actual segment duration started from the Ingestion-Walltime-Us value.
- static parse_youtube_metadata(content: bytes) SegmentMetadata¶
Parses the metadata from the full or partial content of a segment.
All timestamp and time-related values are converted to units of seconds.
Notes
If partial content is provided, the amount of bytes should be enough to cover the metadata header (see
PARTIAL_SEGMENT_SIZE_BYTES).- Parameters:
content – Full or partial segment byte content.
- Returns:
A parsed segment metadata.