Rate this Page

AudioStream#

class torchcodec.encoders.AudioStream(encoder_tensor: Tensor, stream_index: int)[source]#

An audio stream within an Encoder.

Returned by Encoder.add_audio(). Use add_samples() to feed audio samples into this stream.

Examples using AudioStream:

Encoding audio and video streams with the Encoder

Encoding audio and video streams with the Encoder
add_samples(samples: Tensor) None[source]#

Add audio samples to this stream.

Parameters:

samples (torch.Tensor) – The samples to encode. This must be a 2D tensor of shape (num_channels, num_samples). Values must be float values in [-1, 1]. The number of channels must match the num_channels passed to Encoder.add_audio().