coze-plugin-utils
Version:
Comprehensive utility library for Coze plugins with multimedia processing, browser automation, cloud storage integration, and AI-powered video/audio generation capabilities
50 lines (49 loc) • 1.87 kB
TypeScript
/**
* 将音频文件从一种格式转换为另一种格式
*
* @param url - 输入音频文件网址
* @param desType - 目标音频格式 (例如: 'mp3', 'wav', 'ogg', 'flac')
* @param srcType - 源音频格式 (可选,如果未提供将通过检测文件头来确定)
* @returns Promise<string> - 转换后的文件路径
*
* @example
* // 将 input.wav 转换为 MP3 格式
* const outputPath = await convertAudio('https://site/to/path/sound.wav', 'mp3');
*
*/
export declare function convertAudio(url: string, desType: string, srcType?: string): Promise<string>;
export declare function mergeVideoAndAudio(videoUrl: string, audioUrl: string, audioType?: 'wav' | 'mp3' | 'ogg' | 'm4a' | 'aac'): Promise<string>;
interface IAssEvents {
text: string;
effect?: string;
layer?: number;
start?: string;
end?: string;
style?: string;
name?: string;
marginL?: number;
marginR?: number;
marginV?: number;
}
/**
* 合成字幕到视频(ASS方式 + 样式)
*/
export declare function burnASSSubtitleToVideo(videoUrl: string, contents: IAssEvents[]): Promise<string>;
/**
* 将多个视频文件按顺序合并成一个视频
*
* @param urls - 视频文件URL数组,按照需要合并的顺序排列
* @param outputFormat - 输出视频格式,默认为'mp4'
* @returns Promise<string> - 合并后的视频文件路径
*
* @example
* // 合并三个视频文件
* const outputPath = await joinVideos([
* 'https://example.com/video1.mp4',
* 'https://example.com/video2.mp4',
* 'https://example.com/video3.mp4'
* ]);
*/
export declare function joinVideos(urls: string[], outputFormat?: string): Promise<string>;
export declare function mergeWithDelayAndStretch(videoUrl: string, audioUrl: string, videoDuration?: number, audioDuration?: number, subtitle?: string): Promise<string>;
export {};