Add custom processing to Conversion API

This commit is contained in:
Vanilagy
2025-10-17 14:52:13 +02:00
parent 21456e3bf6
commit e880f54553
4 changed files with 362 additions and 44 deletions
+23
View File
@@ -56,6 +56,11 @@
output,
audio: (_, n) => ({
discard: n > 1,
/*
process: (sample) => {
return sample;
},
*/
//codec: 'pcm-s16',
//sampleRate: 16000,
//numberOfChannels: 1,
@@ -92,6 +97,24 @@
},
*/
video: () => ({
/*
process: (sample) => {
if (!ctx) {
// Create a canvas for image compositing
const canvas = new OffscreenCanvas(
sample.displayWidth,
sample.displayHeight,
);
ctx = canvas.getContext('2d');
}
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
sample.draw(ctx, 0, 0);
ctx.drawImage(watermark, 32, 32);
return ctx.canvas;
},
*/
width: 300,
//alpha: 'keep',
//width: 320,