flutterffmpegvideo-watermarking

How to add watermark to video in Flutter using Flutter_ffmpeg


I cannot figure out why my ffmpeg commands aren't working...

  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");

}

Thanks


Solution

  • Are you sure you need the empty space at the end of the watermark file name? Talking about this line specifically:

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