Actually I am using ffmpeg-kit
in react native project for multiple purpose like merge two in horizontal, trim, getting audio from video etc. so 1st I am creating local path then pass it to ffmpeg command now i want to get the actual Url of encode file let me show you my code:
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)
}
})
Second, is there any way to encode/pass input file in ffmpeg
command remote url like from firebase storage?