packages/docs/docs/miscellaneous/parse-media-vs-get-video-metadata.mdx
There are multiple ways to retrieve information about a media such as:
parseMedia()parseMedia() is a library developed by Remotion that parses video files using JavaScript.
✅ It supports more containers than getVideoMetadata(): .mp4, .mov, .webm, .mkv, .avi, .m3u8, .ts, .mp3, .wav, .aac, .m4a and .flac
✅ It supports getting get dimensions of videos shot on iPhones, a common pitfall when using getVideoMetadata() on Linux
✅ It also works on the server in Node.js and Bun.
✅ It only fetches the information you request, needing to read less bytes to get the information you need.
❌ When using in the browser: Assets need to come from the same origin or be CORS-enabled.
getVideoMetadata() from @remotion/media-utilsgetVideoMetadata() will mount a <video> tag in the browser and returns the metadata after it is available.
✅ In the browser, it does not require the assets to be CORS-enabled or be on the same origin.
❌ It only works in the browser.
❌ It does not support some codecs, such as the ones used by iPhone videos.
getVideoMetadata() from @remotion/renderergetVideoMetadata() will read metadata using FFmpeg through a Rust interface.
✅ The widest format compatibility.
❌ It only works in Node.js and Bun, so you cannot use it in calculateMetadata().
❌ It invokes a Rust binary, so bundling it is not straightforward.