0
  1. I have use ffmpeg and mp4parser to add image watermark on video. both works when video size is small like less than 5MB to 7Mb but when it comes to large video size(anything above than 7MB or so..) it fails and it doesn't not work.

what are the resources that helps to adding watermark on video quickly. if you have any useful resources that please let me know?

1 Answers1

0

It depends on what exactly you need.

If the watermark is just needed when the video is viewed on the android device, the easiest and quickest way is to overlay the image with a transparent background over the video view. You will need to think about fullscreen vs inline and portrait vs landscape to ensure it lines up as you want.

If you want to watermark the video itself, so that the watermark is included if the video is copied or sent elsewhere, then ffmpeg is likely as fast as other solutions on the device itself. If you are able to send the video to a server and have the watermark applied there you will have the ability to use much more powerful compute resource.

Mick
  • 24,231
  • 1
  • 54
  • 120
  • well, I want to add a watermark on the video, picking from the gallery itself, the user just select the video from their gallery or any media relevant as mp4, mp4parser so as FFmpeg works to do this stuff, but when comes to the large quality video it takes insane amount of time – Ravi Sorathiya Nov 23 '21 at 03:53
  • Unfortunately, video processing is high overhead, especially anything beyond simple encoding and decoding, which often benefits from HW acceleration. It might be worth creating a new separate question and sharing the ffmpeg command or code you are using to ask if anyone can suggest some optimisations, although I suspect the watermarking will still take quite a bit of time on a mobile for a large video. – Mick Nov 23 '21 at 09:11
  • val cmd = arrayOf( "-y", "-i", sourcePath, // source video "-i", watermarkImagePath, // watermaek path "-filter_complex", "overlay=$position", // watermark position "-c:v", "libx264", "-preset", "ultrafast", outputLocation.path // encoded video ) I have used this cmd in FFmpeg to adding a watermark – Ravi Sorathiya Nov 23 '21 at 10:08
  • https://github.com/MasayukiSuda/Mp4Composer-android it's mp4 references which help to add watermark on video – Ravi Sorathiya Nov 23 '21 at 10:46