你好朋友我尝试在 React 本机应用程序中压缩视频我已经使用了https://github.com/shahen94/react-native-video-processing但我没有得到实际减小的视频文件大小。
我尝试实现 https://www.npmjs.com/package/react-native-ffmpeg包并尝试编译,但它给出返回码 1 并且过程失败,在这个过程中我使用 -y -i ${val} - c copy -map 0:v libx264 -b:v 0.5M -c:a aac -b:a 1000k ${data} {val是输入视频文件,数据是输出视频文件}
我的代码: RNFFprobe.getMediaInformation(val).then(information => { console.log('Result: ' + JSON.stringify(information)); });
-y -i ${val} -c copy -map 0:v libx264 -b:v 0.5M -c:a aac -b:a 1000k ${data} const data=val RNFFmpeg.executeAsync(
-i ${val} -c copy - map 0:v libx264 -b:v 0.5M -c:a aac -b:a 1000k ${data} , completedExecution => { if (completedExecution.returnCode === 0) { console.log("FFmpeg process completed successfully"); } else { console.log(
FFmpeg 进程失败,rc=${completedExecution.returnCode}。); } }).then(executionId => console.log(
异步 FFmpeg 进程以 executionId ${executionId} 开始。)) .catch(error=>console.log(error))