如何使用 Flutter_ffmpeg 在 Flutter 中为视频添加水印

How to add watermark to video in Flutter using Flutter_ffmpeg

我不明白为什么我的 ffmpeg 命令不起作用...

  Future<void> watermark(filePath, width, height) async {

final String outPath = 'watermarked.mp4';
final String inputVideo =
    await rootBundle.loadString('assets/ffmpeg/demo.mov');
final String inputWatermark = await rootBundle
    .loadString('assets/ffmpeg/video_overlay.png');
final arguments =
    '-i $inputVideo -i $inputWatermark -filter_complex overlay=10:10 -codec:a copy $outPath';


final int rc = await FlutterFFmpeg().execute(arguments);
assert(rc == 0);
print("outPath $outPath");

uploadFile(outPath, "gallery");

}

谢谢

您确定水印文件名末尾需要空 space 吗?具体说说这一行:

final String inputWatermark = await rootBundle.loadString('assets/ffmpeg/video_overlay.png ');