mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Drag 0-duration VideoFrame duration to null (fixes #116)
This commit is contained in:
+4
-3
@@ -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);
|
||||
</script>
|
||||
+4
-3
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user