嘿,每个人都在 React Native 中使用 ffmpeg-kit,我需要帮助来理解一些要点。我的第二个问题是我们可以在 ffmpeg 命令中使用远程 url

Ahm*_*loy 5 ffmpeg reactjs react-native mobile-ffmpeg

实际上,我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 (session) => {
            const returnCode = await session.getReturnCode();
            if (ReturnCode.isSuccess(returnCode)) {
                console.log('Success')
                // SUCCESS
                console.log(session)
                setmodalvisible(false)
                props.navigation.navigate('DuetDetails', { filepath });

            } else if (ReturnCode.isCancel(returnCode)) {

                // CANCEL
                console.log('cancle by user')
                setmodalvisible(false)

            } else {

                // ERROR
                console.log('error')
                setmodalvisible(false)

            }
        })
Run Code Online (Sandbox Code Playgroud)

其次,是否有任何方法可以ffmpeg像 Firebase 存储一样在命令远程 url 中编码/传递输入文件?