How to add watermark to video in Flutter using Flutter_ffmpeg

462

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 ');
Share:
462
user433575
Author by

user433575

Updated on December 29, 2022

Comments

  • user433575
    user433575 over 1 year

    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

  • user433575
    user433575 almost 3 years
    good find, but sorry forgot I pasted the wrong line in. I fixed original question. Have you successfully watermarked a video using flutter_ffmpeg? if so, would you mind sharing your code? thank you
  • mkobuolys
    mkobuolys almost 3 years
    No, I have not, but what you are trying to achieve is not Flutter related. It is more like a specific command of FFmpeg. Just try not to focus on Flutter context but search for a common watermark solution/command, e.g.: stackoverflow.com/questions/10918907/…