请帮我看看,我的需求是音视频合并,试了无数次,都高不成功,文档也写的不详细,请给指导一下。
已经差多官方文档,但是写的很模糊,解决问题全靠猜
async combineVideoAndAudio(videoKey, audioKey, targetKey, pipeline) {
//已经上传到bucket
const videoUrl = `${videoKey}`;//01z001d15tddduokaj00mtsczd0023hi.mp4
const audioUrl = `${audioKey}`;//01z001d15tddduokaj00mtsczd0023he.mp4
const videoUrlSafeBase64 = qiniu.util.urlsafeBase64Encode(videoUrl);
const audioUrlSafeBase64 = qiniu.util.urlsafeBase64Encode(audioUrl);
const saveasKey = qiniu.util.urlsafeBase64Encode(`${targetKey}`);
const fops = `avconcat/1/format/mp4/${videoUrlSafeBase64}/${audioUrlSafeBase64}`;
try {
const result = await this.executePfop(this.bucket, videoKey, encodeURIComponent(fops), pipeline);
if (result.statusCode === 200) {
return `http://${this.domain}/${targetKey}`;
} else {
throw new Error(`Failed to combine video and audio: ${result.statusCode}, ${JSON.stringify(result)}`);
}
} catch (error) {
throw error;
}
}