更新记录
1.0.0(2025-01-23)
基础功能导出
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.94,Android:5.0,iOS:11,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
鸿蒙元服务 |
× |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
AVFramework组件
AVFramework致力于让用户轻松实现音视频剪切合并等功能
快速接入方法
加载模块
import {cutVideoWithParams,extractImageFromVideo,mergeVideosWithInputPaths,convertAudioWithInputPath,extractAudioFromVideo,changeVideoResolution,rotateVideo,addWatermarkToVideo,removeWatermarkFromVideo,changeVideoSpeed,convertVideoFormat,adjustVideoVolume,extractKeyFramesFromVideo,extractAudioSegment,mergeAudioWithInputPaths,extractFramesFromVideo,convertVideoToGIF,rotateAndCropVideo,resizeVideo,mirrorVideo,blurBackgroundInVideo,reverseVideo,changeFrameRate,extractSubtitlesFromVideo,addSubtitlesFromVideo,removeSubtitlesFromVideo,flipVideo,getVideoInfo,combineAudioWithVideo,adjustAudioVolume,generateCoverForVideo,convertAudioToVideo,changeVideoFrameRate,compressVideo,removeAudioFromVideo,cancel} from "@/uni_modules/fast-avframework";
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"startTime":"0","endTime":"10","outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "out.mp4"};
cutVideoWithParams({
params:params,
complete:(res)=>{
console.log(res);
}
})
字段 |
说明 |
inputPath |
视频输入路径 |
startTime |
开始时间 |
endTime |
结束时间 |
outputPath |
指定的输出文件路径 |
|
|
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"time":"10","outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "test.png"};
extractImageFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频输入路径 |
time |
时间(s) |
outputPath |
指定的输出图片路径 |
var path1 = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
var path2 = plus.io.convertLocalFileSystemURL('/static/test2.mkv');
let params = {"inputPaths":[path1,path2],"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "merge.mp4"};
mergeVideosWithInputPaths({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPaths |
视频的输入路径(数组) |
outputPath |
指定的输出文件路径 |
音频转换
var path = plus.io.convertLocalFileSystemURL('/static/in.wav');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "outaudio.aac"};
convertAudioWithInputPath({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
音频提取
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "outaudio.aac"};
extractAudioFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
改变视频分辨率
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"width":640,"height":480,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "640x480.mp4"};
changeVideoResolution({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
width |
视频的宽 |
height |
视频的高 |
视频旋转
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"angle":90,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "xuanzhuan.mp4"};
rotateVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
angle |
旋转角度 |
视频加水印
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"x":10,"y":10,"inputPath":path,"watermarkPath":plus.io.convertLocalFileSystemURL("static") + "/" + "in.png","outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "shuiying.mp4"};
addWatermarkToVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
x |
位置x |
y |
位置y |
改变播放速度
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"speed":120,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "videoSpeed.mp4"};
changeVideoSpeed({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
speed |
播放速度 |
转换视频格式
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "videoformat.wav"};
convertVideoFormat({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
改变音量大小
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "volume.mp4","volume":200};
adjustVideoVolume({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
volume |
音量大小 |
解析关键帧
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputImageDirectory":plus.io.convertLocalFileSystemURL("static") + "/" + "keyframes"};
extractKeyFramesFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputImageDirectory |
指定的输出文件夹路径 |
裁剪音频
var path = plus.io.convertLocalFileSystemURL('/static/in.wav');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "audiocut.mp3","startTime":0,"endTime":1};
extractAudioSegment({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
startTime |
开始时间(s) |
endTime |
结束时间(s) |
合并音频
var path1 = plus.io.convertLocalFileSystemURL('/static/in.wav');
var path2 = plus.io.convertLocalFileSystemURL('/static/inputaac.aac');
let params = {"inputPaths":[path1,path2],"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "merge.mp3"};
mergeAudioWithInputPaths({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPaths |
视频的输入路径(数组) |
outputPath |
指定的输出文件路径 |
提取视频里面每帧图片
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputImageDirectory":plus.io.convertLocalFileSystemURL("static") + "/" + "frames"};
extractFramesFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPaths |
视频的输入路径(数组) |
outputImageDirectory |
指定的输出文件夹路径 |
interval |
1s输出多少张 |
转换video为gif
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"startTime":"0","endTime":"5","outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "gif.gif"};
convertVideoToGIF({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
startTime |
开始时间(s) |
endTime |
开始时间(s) |
旋转和剪切视频
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"angle":0,"cropArea":"200:200:0:0","outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "rote.mp4"};
rotateAndCropVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
angle |
角度 |
cropArea |
宽:高:x:y |
缩放视频
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"width":640,"height":480,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "resize.mp4"};
resizeVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
width |
视频宽度 |
height |
视频高度 |
视频镜像
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "mirror.mp4"};
mirrorVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
视频模糊
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"blurStrength":10,"blurRadius":1,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "blur.mp4"};
blurBackgroundInVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
blurRadius |
模糊圆角 |
blurStrength |
模糊强度 |
反转视频
var path = plus.io.convertLocalFileSystemURL('/static/test2.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "reverse.mp4"};
reverseVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
改变视频帧率
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"frameRate":120,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "changerate.mp4"};
changeFrameRate({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
frameRate |
帧率 |
提取字幕
var path = plus.io.convertLocalFileSystemURL('/static/addSubtitles.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "extractSubtitles.srt"};
extractSubtitlesFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
添加字幕
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
var subTitlePath = plus.io.convertLocalFileSystemURL('/static/helloworld.srt');
let params = {"inputPath":path,"subtitlesPath":subTitlePath,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "addSubtitles.mp4"};
addSubtitlesFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
subTitlePath |
指定字幕的输出文件路径 |
移除字幕
var path = plus.io.convertLocalFileSystemURL('/static/addSubtitles.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "removeSubtitles.mp4"};
removeSubtitlesFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
视频镜像
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "flipVideo.mp4"};
flipVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
视频的输入路径 |
outputPath |
指定的输出文件路径 |
获取视频信息
var path = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":path};
getVideoInfo({
params:params,
complete:(res)=>{
console.log(res);
}
});
音视频合并
var audioPath = plus.io.convertLocalFileSystemURL('/static/inputaac.aac');
var videoPath = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPaths":[audioPath,videoPath],"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "combine.mp4"};
combineAudioWithVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPaths |
音视频的输入路径(数组) |
outputPath |
指定的输出文件路径 |
调整音频音量
var audioPath = plus.io.convertLocalFileSystemURL('/static/inputaac.aac');
let params = {"inputPath":audioPath,"volume":200,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "adjust.aac"};
adjustAudioVolume({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
volume |
音量大小 |
生成视频封面
var videoPath = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":videoPath,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "cover.png"};
generateCoverForVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
把音频转换为视频
var audioPath = plus.io.convertLocalFileSystemURL('/static/inputaac.aac');
var imagePath = plus.io.convertLocalFileSystemURL('/static/in.png');
let params = {"inputPath":audioPath,"imagePath":imagePath,"width":1920,"height":1080,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "audiotovideo.mp4"};
convertAudioToVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
imagePath |
图片文件 |
width |
视频宽度 |
height |
视频高度 |
改变视频的帧率
var videoPath = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":videoPath,"frameRate":30,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "changevideoframe.mp4"};
changeVideoFrameRate({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
frameRate |
视频帧率 |
视频压缩
var videoPath = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":videoPath,"bitrate":"2M","audioBitrate":"96k","width":640,"height":480,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "compressVideo.mp4"};
compressVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
bitrate |
视频码率 |
audioBitrate |
音频码率 |
width |
视频宽 |
height |
视频高 |
videoCodec |
视频编码 |
audioCodec |
音频编码 |
清除视频里面的声音
var videoPath = plus.io.convertLocalFileSystemURL('/static/test1.mp4');
let params = {"inputPath":videoPath,"outputPath":plus.io.convertLocalFileSystemURL("static") + "/" + "removeAudioFromVideo.mp4"};
removeAudioFromVideo({
params:params,
complete:(res)=>{
console.log(res);
}
});
字段 |
说明 |
inputPath |
音频的输入路径 |
outputPath |
指定的输出文件路径 |
取消任务id
cancel({
params:params,
complete:(res)=>{
console.log(res);
}
});