Yapperino

This commit is contained in:
Vanilagy
2025-06-16 20:51:58 +02:00
parent f675966004
commit 28597ea93c
7 changed files with 129 additions and 30 deletions
+31
View File
@@ -0,0 +1,31 @@
# Quick start
This page is a collection of short code snippets to showcase the most common operations you may use this library for.
## Reading file metadata
```ts
import { Input, ALL_FORMATS, BlobSource } from 'mediabunny';
const input = new Input({
formats: ALL_FORMATS,
source: new BlobSource(file), // Assuming a File instance
});
const duration = await input.computeDuration(); // in seconds
const videoTrack = await input.getPrimaryVideoTrack();
if (videoTrack) {
const width = videoTrack.displayWidth;
const height = videoTrack.displayHeight;
const rotation = videoTrack.rotation; // in degrees clockwise
}
const audioTrack = await input.getPrimaryAudioTrack();
if (audioTrack) {
const numberOfChannels = audioTrack.numberOfChannels;
const sampleRate = audioTrack.sampleRate; // in Hz
}
```
## Reading media data