实际上,我ffmpeg-kit在 React Native 项目中用于多种目的,例如水平合并两个、修剪、从视频中获取音频等。因此,我首先创建本地路径,然后将其传递给 ffmpeg 命令,现在我想获取编码文件的实际 Url 让我向你展示我的代码:
const _makeDuet = async (firstVideo, secondVideo) => {
// console.log(firstVideo,secondVideo)
setmodalvisible(true)
const path = `${RNFS.MainBundlePath}`
let filepath = RNFS.ExternalDirectoryPath + '/panting_duet' + Date.now() + '.mp4'
let cmd2 = `-i ${secondVideo} -i ${secondVideo} -filter_complex [0:v][1:v]hstack=inputs=2:shortest=1[outv] -r 25 -b:v 8M -minrate 6M -maxrate 8M -bufsize 4M -map 1:a -shortest -map [outv] ${filepath}`
// const path = `${RNFS.MainBundlePath}/intro.mp4`
// let filepath = RNFS.ExternalStorageDirectoryPath+'/panting_videos'+Date.now()+'.mp3'
// let mkdir = RNFS.mkdir("panting")
// console.log(filepath)
await FFmpegKit.executeAsync(cmd2, async …Run Code Online (Sandbox Code Playgroud)