Media¶
- class audformat.Media(type='other', *, format=None, sampling_rate=None, channels=None, bit_depth=None, video_fps=None, video_resolution=None, video_channels=None, video_depth=None, description=None, meta=None)[source]¶
Media information.
File
formatis always converted to lower case.- Parameters:
type (
str) – media type, seeaudformat.define.MediaTypefor available media typesformat (
str) – file format (e.g. ‘wav’, ‘flac’, ‘mp4’)sampling_rate (
int) – audio sampling rate in Hzchannels (
int) – number of audio channelsbit_depth (
int) – audio bit depthvideo_fps (
int) – video rate in frames per secondsvideo_resolution (
Sequence[int]) – video resolution in pixels (e.g.[800, 600])video_channels (
int) – number of channels per pixel (e.g. 3 for RGB)video_depth (
int) – number of bits per video channeldescription (
str) – media descriptionmeta (
dict) – additional meta fields
- Raises:
BadValueError – if an invalid
typeis passed
Examples
>>> Media( ... type=define.MediaType.AUDIO, ... format="wav", ... sampling_rate=16000, ... channels=2, ... ) {type: audio, format: wav, channels: 2, sampling_rate: 16000}
__eq__()¶
bit_depth¶
- Media.bit_depth¶
Audio bit depth
channels¶
- Media.channels¶
Audio channels
description¶
- Media.description¶
Description
dump()¶
format¶
- Media.format¶
File format
from_dict()¶
meta¶
- Media.meta¶
Dictionary with meta fields
sampling_rate¶
- Media.sampling_rate¶
Audio sampling rate in Hz
to_dict()¶
type¶
- Media.type¶
Media type
video_channels¶
- Media.video_channels¶
Video channels per pixel
video_depth¶
- Media.video_depth¶
Video bit depth
video_fps¶
- Media.video_fps¶
Video frames per second
video_resolution¶
- Media.video_resolution¶
Video resolution