1

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
  • 357
  • 1
  • 4
  • 13

1 Answers1

1

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 ');
mkobuolys
  • 4,499
  • 1
  • 11
  • 27
  • 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 – user433575 May 14 '21 at 00:05
  • 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.: https://stackoverflow.com/questions/10918907/how-to-add-transparent-watermark-in-center-of-a-video-with-ffmpeg – mkobuolys May 14 '21 at 15:21