Capítulo 697 de 988

Chapter 697: Stream selection

Core Idea

:::warning We are phasing out Media Parser and are moving to Mediabunny!

Key Concepts

  • Selecting a M3U stream
  • Show a stream selection interface
  • Resorting to default behavior
  • Selecting an audio track
  • See also

Code Examples

const media = await parseMedia({
  src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
  selectM3uStream: ({streams}) => {
    for (const stream of streams) {
      console.log(stream.dimensions); // {width: 1920, height: 1080}
      console.log(stream.bandwidthInBitsPerSec); // 4400000
      console.log(stream.src); // "https://test-streams.mux.dev/x36xhzz/193039199_mp4_h264_aac_hd_7.m3u8"
      console.log(stream.averageBandwidthInBitsPerSec); // null
      console.log(stream.codecs); // ["avc1.640028", "mp4a.40.2"]
      console.log(stream.associatedPlaylists); // See below
    }

    return streams[0].id;
  },
});
  • What it demonstrates: Usage pattern for Stream selection from the official docs.

Key Takeaways

  1. Understand selecting a m3u stream when working with Stream selection.
  2. Understand show a stream selection interface when working with Stream selection.
  3. Understand resorting to default behavior when working with Stream selection.
  4. Understand selecting an audio track when working with Stream selection.
  5. Understand see also when working with Stream selection.

Connects To

  • Download and Parse: related page in the Media Parser (@remotion/media-parser) section.
  • Download and Parse Media: related page in the Media Parser (@remotion/media-parser) section.
  • Fast and Slow: related page in the Media Parser (@remotion/media-parser) section.