mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-09 08:43:49 +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, {
|
let videoSource = new Mediabunny.CanvasSource(canvas, {
|
||||||
codec: 'avc',
|
codec: 'vp9',
|
||||||
//fullCodecString: 'avc1.42001f',
|
//fullCodecString: 'avc1.42001f',
|
||||||
bitrate: 1e6
|
bitrate: 1e6,
|
||||||
|
onEncoderConfig: console.log,
|
||||||
});
|
});
|
||||||
let audioSource = new Mediabunny.AudioBufferSource({
|
let audioSource = new Mediabunny.AudioBufferSource({
|
||||||
codec: 'opus',
|
codec: 'opus',
|
||||||
@@ -207,5 +208,5 @@ Testing... <00:17.350>One... <00:18.125>Two...
|
|||||||
await output.finalize();
|
await output.finalize();
|
||||||
|
|
||||||
console.log(target);
|
console.log(target);
|
||||||
download(new Blob([target.buffer]), 'test' + format.fileExtension);
|
//download(new Blob([target.buffer]), 'test' + format.fileExtension);
|
||||||
</script>
|
</script>
|
||||||
+4
-3
@@ -201,7 +201,8 @@ export class VideoSample {
|
|||||||
return new VideoSample(
|
return new VideoSample(
|
||||||
new VideoFrame(data, {
|
new VideoFrame(data, {
|
||||||
timestamp: Math.trunc(init.timestamp! * SECOND_TO_MICROSECOND_FACTOR),
|
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,
|
init,
|
||||||
);
|
);
|
||||||
@@ -373,13 +374,13 @@ export class VideoSample {
|
|||||||
codedWidth: this.codedWidth,
|
codedWidth: this.codedWidth,
|
||||||
codedHeight: this.codedHeight,
|
codedHeight: this.codedHeight,
|
||||||
timestamp: this.microsecondTimestamp,
|
timestamp: this.microsecondTimestamp,
|
||||||
duration: this.microsecondDuration,
|
duration: this.microsecondDuration || undefined,
|
||||||
colorSpace: this.colorSpace,
|
colorSpace: this.colorSpace,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return new VideoFrame(this._data, {
|
return new VideoFrame(this._data, {
|
||||||
timestamp: this.microsecondTimestamp,
|
timestamp: this.microsecondTimestamp,
|
||||||
duration: this.microsecondDuration,
|
duration: this.microsecondDuration || undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user