cutcutcodec.core.analysis.audio.properties.duration
Find the duration of an audio stream.
This allows not only the characteristics of the files but also the tags if there are any.
Functions
|
Recovers the total duration of an audio stream. |
Details
- cutcutcodec.core.analysis.audio.properties.duration.get_duration_audio(filename: Path | str | bytes, index: int = 0, *, accurate: bool = False) Fraction[source]
Recovers the total duration of an audio stream.
The duration includes the display time o the last frame.
Parameters
- filenamepathlike
The pathlike of the file containing an audio stream.
- indexint
The relative index of the audio stream being considered, by default the first audio stream encountered is selected.
- accurateboolean, optional
If True, recovers the duration by fully decoding all the frames in the audio. It is very accurate but very slow. If False (default), first tries to get the duration from the file metadata. It’s not accurate but very fast.
Returns
- durationFraction
The total duration of the considerated audio stream.
Raises
- MissingStreamError
If the file does not contain a playable audio stream.
- MissingInformation
If the information is unavailable.