I'm trying to add 2 watermarks to a video, one should be a .png file and the second some moving/scrolling text.
Png = fixed at right bottom
Text = Moving/scrolling from the top right to the top left. Starting at 50% of total video length (appear at 1:00 if total length is 2:00) and disappearing in 20 seconds.
I already use a command to encode the video and add a logo at the right bottom but having trouble adding scrolling text at the same time.
-i logo.png -filter_complex "overlay=main_w-overlay_w:main_h-overlay_h-4" -keyint_min 20 -vcodec libx264 -c:a copy -b:v 1500k -movflags +faststart
You need to concatenate overlay and drawtext filters:
ffmpeg -i input.mp4 -i logo.png -filter_complex "[0:v][1:v] overlay=x=(main_w-overlay_w):y=(main_h-overlay_h),drawtext=text=string1:y=line_h-10:x='if(gte(t,30),w-(t-30)*w/20,w)'" -c:a copy output.mp4
In this example, the video lasts 60s, so I set 30s into the if block. If you need to automate the video length, I recommend you a bash script (use ffprobe to get the duration). You can also customize the font (color, size...) adding colons between properties. More info:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments