parseMediaOnServerWorker()
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.
This API is the same as parseMediaOnWebWorker()
, but besides reading from URLs and File
objects, you can also pass file paths that will be read using the fs
module.
This makes the function also work on the server, but incompatible with the browser.
Only Bun has support for Worker
, while Node.js does not. That means that this function currently only makes sense if you want to run a media parse on Bun on a worker thread.
We do not test against Deno's Worker
implementation.
Parsing a video on a Bun Workertsx
import {parseMediaOnServerWorker } from '@remotion/media-parser';constresult = awaitparseMediaOnServerWorker ({src : '/tmp/video.mp4',fields : {durationInSeconds : true,dimensions : true,},});console .log (result .durationInSeconds ); // 10console .log (result .dimensions ); // {width: 1920, height: 1080}
API
Same as parseMedia()
, but without the option to pass a reader
.
The reader
option in the worker is hardcoded to universalReader
.