I am using drawtext to add watermark to videos
The problem is with watermark size.. It changes itself according to the original video resolution.Code:-vf drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=hello::ontcolor=white:shadowcolor=black:shadowx=1:shadowy=1:x=w-tw-2:y=h-th-2
For Ex: A watermark with fontsize of 20 looks too large when a original video with small resolution is converted and looks too small when original video with large resolution is converted..
How to fix this size ??
+ Reply to Thread
Results 1 to 16 of 16
That is because using the same size font in higher resolution is like when you change your desktop resolution. The higher you go the smaller the Icon letters become so 1280x720 has smaller letters than 640x480. Since you increase the number of number of pixels with higher resolution in the same space, the fonts appear smaller. I'm sure there is a much better explanation but the simplest method is increase the font size as a proportion of your resolution.
In the photos below I picked a Font of 15 size that looked good in 640x360 then used the same font in 1280x720 and then 30 Font size with 1280x720. You can see the 30 font (1280x720) and the 15 font (640x360) appear almost the same size. You just need to pick one that looks good at a certain resolution and then adjust per the difference as "New Size = FontSizeyouLiked x NewResolution / ResolutionYouLiked"
1280x720 Font size 15
640x360 Font Size 15
1280x720 Font Size 30 (Image Size reduced by 1/2)
Actually i don't want to input different font sizes for each video.. I want to make it stable for each resolution.. Is there any way to make it stable ?
I've been trying to calculate it but for some reason my ffmpeg drawtext doesn't seem to understand:
ffmpeg -i <video.mp4> -vf drawtext="fontsize=15*main_h/640:fontfile=FreeSerif.ttf:text=hello\\::fontcolor=white: shadowcolor=black: shadowx=1: shadowy=1: x=w-tw-2: y=h-th-2"
Last edited by Budman1; 17th Feb 2014 at 14:45.
Looking at the output of
ffplay -i "F:\TestClips&Co\test.avi" -vf drawtext="fontsize=15*main_h/640:fontfile=FreeSerif.ttf:text='hello':fontcolor=white:shadowcolor=black:shadowx=1:shadowy=1:x=w-tw-2:y=h-th-2"
[drawtext @ 00000000092c7d60] [Eval @ 0000000008a9f2a0] Undefined constant or missing '(' in 'main_h/640' [drawtext @ 00000000092c7d60] Unable to parse option value "15*main_h/640" [drawtext @ 00000000092c7d60] [Eval @ 0000000008a9f310] Undefined constant or missing '(' in 'main_h/640' [drawtext @ 00000000092c7d60] Unable to parse option value "15*main_h/640" [drawtext @ 00000000092c7d60] Error setting option fontsize to value 15*main_h/640. [Parsed_drawtext_0 @ 000000000277ede0] Error applying options to the filter. Error initializing filter 'drawtext' with args 'fontsize=15*main_h/640:fontfile=FreeSerif.ttf:text=hello:fontcolor=white:shadowcolor=black:shadowx=1:shadowy=1:x=w-tw-2:y=h-th-2'
-> may be asking in the ffmpeg irc channel will help
Ps.: as a side note, just for consitency I would either use 'h' or 'main_h' to address the height of the input not both (just makes the whole think more confusing), also shrinking the call a bit when trying to find the problem isn't a bad idea either,...
That said, even if I use just:
ffplay -i "F:\TestClips&Co\test.avi" -vf drawtext="fontsize=15*main_h/640:text='hello'"
Last edited by Selur; 18th Feb 2014 at 16:13.
I agree... GUI ability yes... CLI not so much... Is there a large demand for this?
UPDATE: apparently, after reading more, variables such as main_h, etc. are only used for calculating x and y such as :
So, again, it looks like an intermediate utility or program is needed to interrogate the video characteristics. Font will correctly calculate such as , 'fontsize=15*2'. or 'fontsize=15*1280/640' but without knowing the 640/1280/320/xxx it can't be plugged in unless all the videos are the same size. It is possible but you'd need a program that reads the MediaInfo CLI processes output and then creates the script. Something like :
Last edited by Budman1; 18th Feb 2014 at 23:53. Reason: Updated information
Is there any alternative for adding the watermark without any issues regarding the size ?
first alternatives that pop to mind:
- write a batch file (shell script) to analyse the file to get the resolution and then call ffmpeg with the parameters you want
- use Avisynths Subtitle-function (should be easily possible with in example MeGui)
I thought about adding something similar to Hybrid but dropped it since I wanted a ffmpeg&mencoder solution and dropped it after I realized I can't do something like this with mencoder.
- if the images all have the same aspect ratio: create a transparent image which has the correct size matching the largest resolution you encounter; load the normal source and the image with ffmpeg overlay the image over the movie and scale the image to the movie size
- find some one who writes you a small tool which does what you want (or modifies an existing tool)
- post a feature request to the ffmpeg bug tracker and hope that someone finds the time and has interest to implement this
All good suggestions, especially:
•find some one who writes you a small tool which does what you want (or modifies an existing tool)
Is there a large demand for this?
I assume you wish to select a FOLDER and convert ALL videos in it, REGARDLESS of their resolution, and convert to their ORIGINAL resolution ALL using the SAME codec?
If this is not true (the videos are all the same size) then the result is easy since you simply find a resolution that a certain Fontsize looks good. Let's say 640x480 looks good with Fontsize 16. If the videos are all the same resolution, say 720, then your font size would be 'Fontsize=16x720/480' because 720/480 is 1.5 so the Font size would be raised to 24 (16*1.5) and would look proportionally the same size.
Update: and yes the Fontsize will calculate without variables.
Hi, I've got some video, mainly rmvb, I'd like to know what is the best way/software to help hide those watermark?of course I know the part covered by the watermark is non-recoverable. I want a software/way which would be easy and would not generate unreasonably huge files
@keny1999: This thread is about adding watermarks not removing them. -> better open your own separate threadusers currently on my ignore list: deadrats, Stears555
Ultimately the question is are we heading for a Star Trek or Blake 7 style federation.
I'm the developer behind FFQueue. My posts might reflect this! ;-)