feat: add generate silent video

This commit is contained in:
熊潇 2025-04-19 23:28:50 +08:00
parent edfb072ab2
commit b4ac46df1e
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,12 @@
/**
*
* @param duration
* @param sampleRate
* @param channels
* @returns
*/
export const generateSilent = (duration: number = 2, sampleRate: number = 16000, channels: number = 1) => {
const bufferSize = Math.floor(duration * sampleRate * channels * 2); // 2 bytes per sample
const silent = Buffer.alloc(bufferSize);
return silent;
};

View File

@ -1,3 +1,4 @@
export * from './generate-silent.ts';
/** /**
* , * ,
* 1 Buffer 0 PCM * 1 Buffer 0 PCM