Add custom quality factors and quantizer bitrate mode (#448)

* Add custom quality factors and quantizer bitrate mode (closes #327)

* Fix quantizer mode fallback and per-frame quantizer edge cases

* Clean up quantizer mode tests

* Quantizer implementation

* Add quality tests

* Improve conversion codec error message, make test more lenient

* Add quantizer support blog post

---------

Co-authored-by: Vanilagy <[email protected]>
This commit is contained in:
Don Carignan
2026-07-30 17:24:59 +02:00
committed by GitHub
co-authored by Vanilagy
parent 1a99b0371d
commit c3df2a24e5
48 changed files with 1372 additions and 371 deletions
+15 -9
View File
@@ -107,15 +107,15 @@
/*
video: {
discard: true,
bitrate: Mediabunny.QUALITY_VERY_HIGH,
//bitrate: Mediabunny.QUALITY_VERY_HIGH
quality: new Mediabunny.Quality('very-high'),
//quality: new Mediabunny.Quality('very-high')
codec: 'av1',
//width: 800,
//fit: 'fill',
//rotate: 90,
},
audio: {
bitrate: Mediabunny.QUALITY_HIGH,
quality: new Mediabunny.Quality('high'),
codec: 'aac',
},
*/
@@ -129,10 +129,15 @@
},
*/
video: {
process: (sample) => {
sample.draw(ctx, 0, 0, 1280, 720);
return new Mediabunny.VideoSample(canvas, { timestamp: sample.timestamp, duration: sample.duration });
},
codec: 'avc',
bitrate: new Mediabunny.Quality({
quality: Infinity,
}),
forceTranscode: true,
//process: (sample) => {
// sample.draw(ctx, 0, 0, 1280, 720);
// return new Mediabunny.VideoSample(canvas, { timestamp: sample.timestamp, duration: sample.duration });
//},
},
tags: {} ?? {
title: 'Bigggy',
@@ -152,8 +157,9 @@
}
},
trim: {
start: -2,
end: 10,
end: 20,
//start: -2,
//end: 10,
//start: 300.14984567374756 - 100,
//end: 310.1548298151939 - 100,
//end: 10,