Adding custom text and TC on top of video

Questions and answers on how to get the most out of FFAStrans
Post Reply
Paulo
Posts: 4
Joined: Thu Oct 18, 2018 3:13 pm

Adding custom text and TC on top of video

Post by Paulo » Mon Sep 14, 2020 3:54 pm

Hi!

I'm trying to make a uniform line with text and the original timecode, but I can't figure out how to make it work.

I've got this custom FFmpeg line that I would like the TC to match:

-vf "drawtext=text=Property of X '%s_original_path~1%':x=(w-text_w)/2: y=100:fontfile=/Windows/Fonts/arial.ttf:fontsize=50:fontcolor=white:shadowcolor=black:shadowx=5:shadowy=5"

Is it possible to get the Timecode filter to match the font, size and height but to keep it in the right corner?
Is the Timecode filter based on some Avisynth script and could I modify it somehow? :)

Best Regards
Paul

emcodem
Posts: 689
Joined: Wed Sep 19, 2018 8:11 am

Re: Adding custom text and TC on top of video

Post by emcodem » Tue Sep 15, 2020 7:39 am

Hey Paulo,

Yes, the TC Filter Node uses Avisynth. You can check out the avs script that is generated from the TC Node by just connecting a deliver node directly after the TC node, it will deliver the generated avs script file.

The relevant portion for the TC is this:

Code: Select all

tc_bg = BlankClip(m_clip, width=624, height=128, color=$000000)
m_clip = Overlay(m_clip, tc_bg, x=48, y= 938, opacity=1)
m_clip = ShowSMPTE(m_clip, fps=25, offset="00:00:00:00", x=360, y=1040, font="arial", size=120, text_color=$ffffff)
Return m_clip

In theory you should be able to use this in a custom avisynth node and alter it to your needs.

Paulo
Posts: 4
Joined: Thu Oct 18, 2018 3:13 pm

Re: Adding custom text and TC on top of video

Post by Paulo » Tue Sep 15, 2020 8:16 am

Thank you very much! I'll look into it and see what I can do (I'm a Avisynth noob). :)

emcodem
Posts: 689
Joined: Wed Sep 19, 2018 8:11 am

Re: Adding custom text and TC on top of video

Post by emcodem » Tue Sep 15, 2020 8:28 am

Ah no worries about Avisynth, using the lines that i sent you and alter their parameters should not be too hard...
Just copy the lines in to a custom avs filter (delete all other existing lines in the custom avs filter).

Then, check out the documentation of the showsmpte filter in avisynth, http://avisynth.nl/index.php/ShowFrameNumber#ShowSMPTE

Actually you just need these two lines:

Code: Select all

m_clip = ShowSMPTE(m_clip, fps=25, offset="00:00:00:00", x=360, y=1040, font="arial", size=120, text_color=$ffffff)
Return m_clip
the upper 2 lines just generate a little black rectangle.

But just to let you know, from feeling it should be easier or more accurate to do what you want using your custom ffmpeg instead of avisynth, ffmpeg is capable of doing this.

Post Reply