diff --git a/dev/mux.html b/dev/mux.html
index ad0eeaf..3df9586 100644
--- a/dev/mux.html
+++ b/dev/mux.html
@@ -116,9 +116,10 @@
*/
let videoSource = new Mediabunny.CanvasSource(canvas, {
- codec: 'avc',
+ codec: 'vp9',
//fullCodecString: 'avc1.42001f',
- bitrate: 1e6
+ bitrate: 1e6,
+ onEncoderConfig: console.log,
});
let audioSource = new Mediabunny.AudioBufferSource({
codec: 'opus',
@@ -207,5 +208,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/src/sample.ts b/src/sample.ts
index 285fea2..1f2e074 100644
--- a/src/sample.ts
+++ b/src/sample.ts
@@ -201,7 +201,8 @@ export class VideoSample {
return new VideoSample(
new VideoFrame(data, {
timestamp: Math.trunc(init.timestamp! * SECOND_TO_MICROSECOND_FACTOR),
- duration: Math.trunc((init.duration ?? 0) * SECOND_TO_MICROSECOND_FACTOR),
+ // Drag 0 to undefined
+ duration: Math.trunc((init.duration ?? 0) * SECOND_TO_MICROSECOND_FACTOR) || undefined,
}),
init,
);
@@ -373,13 +374,13 @@ export class VideoSample {
codedWidth: this.codedWidth,
codedHeight: this.codedHeight,
timestamp: this.microsecondTimestamp,
- duration: this.microsecondDuration,
+ duration: this.microsecondDuration || undefined,
colorSpace: this.colorSpace,
});
} else {
return new VideoFrame(this._data, {
timestamp: this.microsecondTimestamp,
- duration: this.microsecondDuration,
+ duration: this.microsecondDuration || undefined,
});
}
}