我用过这个包flutter_ffmpeg:^0.2.10,我的flutter版本是2.0.3,
if (widget.addMusicId != null) {
print("Merge Audio");
//-i video.mp4 -i audio.mp4 -c copy output.mp4
_flutterFFmpeg
.execute(
"-i $videoPath -i ${widget.addMusicId} -c copy ${DateTime.now().millisecondsSinceEpoch.toString()}")
// "-i $videoPath -i ${widget.addMusicId} -c:v libx264 -c:a aac -ac 2 -ar 22050 -map 0:v:0 -map 1:a:0 -shortest $outputVideo")
.then((rc) => print("FFmpeg process exited with rc $rc"));
setState(() {
videoPath = outputVideo;
});
} else {
_flutterFFmpeg
.execute("-i $videoPath -vcodec libx265 -crf 28 $outputVideo")
.then((rc) => print("FFmpeg process exited with rc $rc"));
setState(() {
videoPath = outputVideo;
});
}
提前致谢....