@remotion/media-parser
available from v4.0.190
This is a package that parses video and audio files to extract metadata and samples.
Unstable API: This package is experimental. The API may change in the future.
The API for getting video metadata is stable and may be used in production.
Design goals:
- Support all major containers:
.mp4
,.mov
,.webm
,.mkv
,.avi
,.m3u8
,.ts
,.mp3
,.wav
,.aac
and.flac
. - Easily get various information from multimedia files
- Work in the browser, and server runtimes (Node.js, Bun, Edge, etc.)
- Satisfy your query with minimal fetching
- Functional TypeScript API
- Be useful when passing unsupported media
- Allow decoding video frames and audio samples using WebCodecs
- Pausable, resumable and cancellable
- Seeking - continue parsing in a different section of the file (not yet implemented)
- No dependencies
Installation
- npm
- yarn
- pnpm
- bun
npm i --save-exact @remotion/media-parser@4.0.271
pnpm i @remotion/media-parser@4.0.271
bun i @remotion/media-parser@4.0.271
yarn --exact add @remotion/media-parser@4.0.271
Also update
remotion
and all `@remotion/*`
packages to the same version.Remove all
^
character in front of the version numbers of it as it can lead to a version conflict.Guide
parseMedia()
APIs
The following APIs are available:
Readers
Choose the appropriate reader for your file source:
Writers
Choose how to store files downloaded using downloadAndParseMedia()
:
How does this compare to FFmpeg?
FFmpeg generally is a more mature software and carries more capabilities.
We advise you to use it always if you don't need to call it from JavaScript.
We built @remotion/media-parser
with the focus on making it work well on the web:
- Importing this library is a lot lighter than FFmpeg.wasm, which loads at least 10MB.
- Functional, promise-based API
- Direct integration and intentional usage of JavaScript APIs like
fetch()
,File
,Worker
,AbortController
,node:fs
, resizableArrayBuffer
- Samples are returned in a WebCodecs-compatible format, which makes it easier to decode them in the browser with full hardware acceleration.
How does this compare to MP4Box.js?
We aim to support more container formats than MP4Box.js, so that multimedia files of any kind can be passed in.
MP4Box.js focuses on the ISO Base Media Format and supports reading more boxes, however it does not support reading other container formats.
Thank you
![]() | Tella for boosting the development of @remotion/media-parser with $10.000! |