parseMedia()
Part of the @remotion/media-parser
package.
available from v4.0.190
warning
Unstable API: This package is experimental. We might change the API at any time, until we remove this notice.
Examples
Parsing a hosted videotsx
import {parseMedia } from '@remotion/media-parser';constresult = awaitparseMedia ({src : 'https://example.com/my-video.mp4',fields : {durationInSeconds : true,dimensions : true,},});console .log (result .durationInSeconds ); // 10console .log (result .dimensions ); // {width: 1920, height: 1080}
Parsing a hosted videotsx
import {parseMedia } from '@remotion/media-parser';constresult = awaitparseMedia ({src : 'https://example.com/my-video.mp4',fields : {durationInSeconds : true,dimensions : true,},});console .log (result .durationInSeconds ); // 10console .log (result .dimensions ); // {width: 1920, height: 1080}
Parsing a local filetsx
import {parseMedia } from '@remotion/media-parser';import {nodeReader } from '@remotion/media-parser/node';constresult = awaitparseMedia ({src : '/Users/jonnyburger/Downloads/my-video.mp4',fields : {durationInSeconds : true,dimensions : true,},reader :nodeReader ,});
Parsing a local filetsx
import {parseMedia } from '@remotion/media-parser';import {nodeReader } from '@remotion/media-parser/node';constresult = awaitparseMedia ({src : '/Users/jonnyburger/Downloads/my-video.mp4',fields : {durationInSeconds : true,dimensions : true,},reader :nodeReader ,});
API
warning
Unstable API: This package is experimental. We might change the API at any time, until we remove this notice.
src
Either a local file path, or a URL, or a File
object.
If you pass a local file path, you must also pass nodeReader
as the reader
argument.
If you pass a File
object, you must also pass webFileReader
as the reader
argument.
fields?
An object specifying which fields you'd like to receive.
If you like to receive the field, pass true
as the value.
Possible fields are: