Skip to main content

bytes_as_time

Converts a byte sequence representing a timestamp into a Python datetime object.

def bytes_as_time(
bytes_count: int,
bitrate: int
) - > float

Calculates the estimated playback duration in seconds for a given amount of data based on the provided bitrate.

Parameters

NameTypeDescription
bytes_countintThe total number of bytes to be converted into a time duration.
bitrateintThe data transfer rate in bits per second used to calculate the time estimate.

Returns

TypeDescription
floatThe calculated duration in seconds, derived by dividing the total bits by the bitrate.