Flutter: How to use flutter_ffmpeg to add overlays like watermarks and texts to a video?

Issue

I try to implement the video_editing feature to my app, and I’d tried the Tapioca Package and the Video_Manipulation package but found that they both do not meet my criteria, so I put my last hope on the flutter_ffmpeg package.

But as I read through its official doc on pub.dev, not a thing on my mind but "WHAT THE HECK", I can’t understand what those commands are used for, and though I can’t find anything related to add widget overlays to a video. And almost no tutorial on the web that explains how to use it.

So if you successfully implemented adding watermarks/texts to a video with the ffmpeg package, please show me how. Thanks!~

Solution

ffmpeg -i video.mp4 -i logo.png -filter_complex "[0:v][1:v]overlay=5:5,drawtext=text=:x=(w-0)/8:y=(h-4)/10:fontsize=64:fontcolor=white:ryanwangTV" -c:a copy -movflags +faststart output.mp4

ffmpeg -i video.mp4 -i logo.png

there are the video in cuestion to work and the png image that we want to apply how watermark

  1. the video.mp4 has two "parts" a video and a audio file, remember it

  2. the logo.png is a one image, but it consederer a "video" the duration is miliseconds.

how you call parts of video.mp4 and logo.png?

using mapping, for file 1) you will called [0] and for file 2 (logo.png) you will used [1]

if you want to use the video of video.mp4 you will call [0:v] and the video of png is [1:v]

for watermark use filter complex, to "mix" the image on the video

"[0:v][1:v]overlay=5:5,drawtext=text=:x=(w-0)/8:y=(h-4)/10:fontsize=64:fontcolor=white:ryanwangTV

[0:v][1:v] is the video of video.mp4 and image of logo.png
overlay=5:5 the first 5 is the main video, and the second 5 is the image to put on of the video.

x=(w-0)/8 : is the coordenada x y=(h-4)/10 : the coordenada y

fontsize=64 fontcolor=white and the ultimate word is text that you

want to draw in video

-c:a copy its mean: copy the audio of file 1

-movflags +faststart : is to fast start for users of internet on browsers

output.mp4 is the name final

Answered By – stevejobs

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *