Back to Remotion

Remotion Media Parser

packages/docs/blog/2025-05-20-media-parser.mdx

4.0.4573.3 KB
Original Source

:::note Update September 2025: We are phasing out Media Parser and are moving to Mediabunny! :::

We're taking video even more seriously with our own multimedia library, designed from the ground up for JavaScript and the web!

<iframe style={{ width: '100%', aspectRatio: '16 / 9', }} src="https://www.youtube.com/embed/r3dUGdfVnkM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

Remotion Media Parser Docs

In short, what does Remotion Media Parser achieve?

Better metadata retrieval

Get more information from more file formats, faster. An universal API that works on both the server and the client.

You can choose which metadata you want to retrieve, and Media Parser will choose the fastest way.

tsx
import {parseMedia} from '@remotion/media-parser';

// ---cut---
const result = await parseMedia({
  src: 'https://remotion.media/video.mp4',
  fields: {
    durationInSeconds: true,
    dimensions: true,
    fps: true,
    slowKeyframes: true,
    slowVideoBitrate: true,
    isHdr: true,
    videoCodec: true,
    rotation: true,
    numberOfAudioChannels: true,
    sampleRate: true,
    metadata: true,
  },
});

console.log(result.durationInSeconds);
//                     ^?

Video decoding and processing

Media Parser ties into the WebCodecs API – hardware-accelerated decoding, built right into the browser. Previously hard to use, now made accessible!

tsx
import {parseMedia} from '@remotion/media-parser';

// ---cut---
const result = await parseMedia({
  src: 'https://remotion.media/video.mp4',
  onVideoTrack: (track) => {
    const videoDecoder = new VideoDecoder({
      output: console.log,
      error: console.error,
    });

    return (sample) => {
      videoDecoder.decode(new EncodedVideoChunk(sample));
    };
  },
});

:::note This is an oversimplified example - you might get performance problems running this code with longer videos because samples are being passed faster than they can be decoded. :::

Unlock new use cases

Developers need a better way to work with video on the web.

Media Parser is a foundational library that unlocks many upcoming improvements to Remotion and for the web in general. We will be implementing many of these ideas ourselves, but also invite you to build with Media Parser.

We built the fastest video converter on the web

Try out remotion.dev/convert, our web video converter powered by Remotion Media Parser and WebCodecs. Because it works offline and the conversion is hardware-accelerated, it is faster than any other web converter we could find!

:::note Update, 20th October 2025: We are phasing out Media Parser and are moving to Mediabunny! remotion.dev/convert is now updated to use Mediabunny. :::

<hr />