[FFmpeg-user] Add time code AND a watermark in one pass

Kevin Duffey kevinmduffey at yahoo.com
Sun Feb 25 08:24:51 EET 2018


Hi all,
I have figured out from various sources how to add a watermark using a png file. Works well enough.  
What I also want to do is add timecode at 00:00:00:00 to my video as a text overlay. 
I have tried a few variations with the filter_complex, but I cant seem to get past any number of issues. In particular I get an issue with both text and a text file.. though I am never loading a text file, when trying to use drawtext.
This is on a windows machine, though I suspect other than some of the batch syntax, it would be the same call on linux or mac. In particular I am trying to convert a directory of MOV DNxHR encoded videos to H.265, with the watermark AND timecode added.
I think it would not be hard to add them in two passes.. e.g. add timecode first pass with copy mode, to keep it as DNxHR, then 2nd pass add watermark and convert to H.265 with lower resolution. I was hoping, however, to do it all in one pass, so as to save a lot of time.
Here is what I have, which fails with  Cannot find a valid font for the family Sans.  Even though I specify the font file, and have tried by using \\ and \\\ as well.  One time I was able to get past that, though I dont recall how now, and got the issue of the using both text and a text file with drawtext.
Any help would be greatly appreciated. Naturally the watermark.png is the watermark image. My source DNxHR is 4K.  Here I am specifying h.264, though I would like to render to H.265 if possible... and assuming yahoo accept it as an upload format.

for /R %%a in ("*.mov") do ffmpeg -i "%%a" -i watermark.png -filter_complex "[2:v]scale=4096x2160 [ovrl],[1:v][ovrl]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2; drawtext=fontfile='C:\\Windows\\Fonts||arial.ttf':fontsize=15:timecode='00\:00\:00\:00':r=24:x=(w-tw)/2:y=h-(2*lh):fontcolor=white" -s 720x480 -c:v libx264 -preset ultrafast -crf 20 d:\encoded\%%~na.mp4


Thank you.


More information about the ffmpeg-user mailing list