diff --git a/dev/demux.html b/dev/demux.html
index e55f89a..f4d059d 100644
--- a/dev/demux.html
+++ b/dev/demux.html
@@ -45,11 +45,11 @@
a.download = filename;
a.click();
URL.revokeObjectURL(url);
- }
-
+ }
+
console.log(output.target.buffer)
- download(new Blob([output.target.buffer]), 'converted.mp3');
-
+ download(new Blob([output.target.buffer]), 'converted.mp3');
+
/*
const videoTrack = await input.getPrimaryVideoTrack();
@@ -184,7 +184,7 @@
}
*/
-
+
/*
const videoTrack = await input.getPrimaryVideoTrack();
@@ -245,7 +245,7 @@
*/
//chunks.return();
-
+
//console.log("Done")
/*
@@ -441,31 +441,31 @@
const drain = new Metamuxer.VideoFrameDrain(videoTrack);
for await (const frame of drain.frames()) {
- // ...
- }
+ // ...
+ }
console.log(await videoTrack.getDuration());
*/
/*
- const drain = new Metamuxer.VideoFrameDrain(videoTrack);
+ const drain = new Metamuxer.VideoFrameDrain(videoTrack);
- const width = await videoTrack.getWidth();
- const height = await videoTrack.getHeight();
+ const width = await videoTrack.getWidth();
+ const height = await videoTrack.getHeight();
- const canvas = document.createElement('canvas');
- canvas.width = width;
- canvas.height = height;
- document.body.append(canvas);
+ const canvas = document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ document.body.append(canvas);
- const context = canvas.getContext('2d');
+ const context = canvas.getContext('2d');
- // Top-level for await loop inside the event listener
- for await (const frame of drain.frames()) {
- context.drawImage(frame, 0, 0, width, height);
- frame.close();
- }
+ // Top-level for await loop inside the event listener
+ for await (const frame of drain.frames()) {
+ context.drawImage(frame, 0, 0, width, height);
+ frame.close();
+ }
*/
/*
diff --git a/dev/mux.html b/dev/mux.html
index 55a3558..8acf0c2 100644
--- a/dev/mux.html
+++ b/dev/mux.html
@@ -111,7 +111,7 @@
Example entry 1: Hello world.
`;
-if (false) simpleWebvttFile =
+ if (false) simpleWebvttFile =
`WEBVTT
1
@@ -127,7 +127,7 @@ We are looking straight down 5th Avenue.
Testing... <00:17.350>One... <00:18.125>Two...
`
- simpleWebvttFile =
+ simpleWebvttFile =
`WEBVTT
00:00:01.000 --> 00:00:01.500 align:start line:1
@@ -178,5 +178,5 @@ Testing... <00:17.350>One... <00:18.125>Two...
await output.finalize();
console.log(target);
- download(new Blob([target.buffer]), 'test' + format.fileExtension);
+ //download(new Blob([target.buffer]), 'test' + format.fileExtension);
\ No newline at end of file
diff --git a/docs/guide/reading-overview.md b/docs/guide/reading-overview.md
index 5cc76c6..be22a4b 100644
--- a/docs/guide/reading-overview.md
+++ b/docs/guide/reading-overview.md
@@ -94,7 +94,7 @@ track.type; // => 'video' | 'audio' | 'subtitle';
track.isVideoTrack(); // => boolean
track.isAudioTrack(); // => boolean
-// Retrieve the track's language as an ISO 639-2 language code.
+// Retrieve the track's language as an ISO 639-2/T language code.
// Resolves to 'und' (undetermined) if the language isn't known.
track.languageCode; // => string
```
diff --git a/docs/guide/writing-overview.md b/docs/guide/writing-overview.md
index f40fe22..fff546e 100644
--- a/docs/guide/writing-overview.md
+++ b/docs/guide/writing-overview.md
@@ -42,11 +42,13 @@ For each track you want to add, you'll need to create a unique [media source](./
Optionally, you can specify additional track metadata when adding tracks:
```ts
-// This specifies that the video track should be rotated by 90 degrees clockwise
-// before being displayed by video players, and that a frame rate of 30 FPS is
-// expected.
+// This specifies that the video track should be rotated by 90 degrees
+// clockwise before being displayed by video players, and that a frame rate
+// of 30 FPS is expected.
output.addVideoTrack(videoSource, {
- rotation: 90, // Clockwise rotation in degrees
+ // Clockwise rotation in degrees
+ rotation: 90,
+ // Expected frame rate in hertz
frameRate: 30,
});
@@ -66,6 +68,15 @@ output.addSubtitleTrack(subtitleSourceFre, { language: 'fre' });
output.addSubtitleTrack(subtitleSourceIta, { language: 'ita' });
```
+::: info
+The optional `frameRate` video track metadata option specifies the expected frame rate of the video. All timestamps and durations of frames that will be added to this track will be snapped to the specified frame rate. You should avoid adding frames more often than the rate permits, as this will lead to multiple frames having the same timestamp.
+
+To precisely achieve common fractional frame rates, make sure to use their exact fractional forms:
+$23.976 \rightarrow 24000/1001$\
+$29.97 \rightarrow 30000/1001$\
+$59.94 \rightarrow 60000/1001$
+:::
+
As an example, let's add two tracks to our output:
- A video track driven by the contents of a `