{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# StreamReader Basic Usages\n\n**Author**: [Moto Hira](moto@meta.com)_\n\nThis tutorial shows how to use :py:class:`torchaudio.io.StreamReader` to\nfetch and decode audio/video data and apply preprocessings that\nlibavfilter provides.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
This tutorial requires FFmpeg libraries.\n Please refer to `FFmpeg dependency
The coverage of the supported media (such as containers, codecs and protocols)\n depend on the FFmpeg libraries found in the system.\n\n If `StreamReader` raises an error opening a source, please check\n that `ffmpeg` command can handle it.
When using an unseekable file-like object, the source media has to be\n streamable.\n For example, a valid MP4-formatted object can have its metadata either\n at the beginning or at the end of the media data.\n Those with metadata at the beginning can be opened without method\n `seek`, but those with metadata at the end cannot be opened\n without `seek`.
The number of streams is NOT the number of channels.\n Each audio stream can contain an arbitrary number of channels.
When configuring multiple output streams, in order to keep all\n streams synced, set parameters so that the ratio between\n ``frames_per_chunk`` and ``sample_rate`` or ``frame_rate`` is\n consistent across output streams.