Add text to video and save output

What I'm trying to do is take the โ€œinputโ€ video file (I can make it any type of file that makes it the easiest), and then through my code add the text to the video file.

So, for example, it will take "Sample1.mpg" and output "Sample2.mpg". He didnโ€™t show the video (I found several manuals that talk about overlaying text when playing a video, but the video file actually doesnโ€™t change.

Basically, I would like to say: "From seconds 1 to 200, draw" Hi Mom "at position 0,0 with this font" and save them in the resulting video. Whenever you run the displayed video, with any player you will receive a text; because it will be part of the video file.

I heard statements like "DirectShow!" but I really welcome something a little more specific.

+3
source share
3 answers

You can use an extremely powerful scripting language called avisynth

link: http://avisynth.org/

It works with ANY file that you can play, it uses directshow.

Just install it, basically installing the VFW codec, but very easy. Open notepad and enter

DirectShowSource("C:\dir\filename.extension")
Subtitle("Put Your text here")

Save it as "any name. Avs "

. avi- ( avi, !), . . .

Subtitle() : http://avisynth.org/mediawiki/Subtitle

, avisynth , , , ( ) , โ€‹โ€‹ , , .

: http://avisynth.org/mediawiki/External_plugins

: http://avisynth.org/warpenterprises/

, . 2 , , , 1 AVI ( " ", AVS ).

+1

:

.NET

Graphics g = Graphics.FromImage(bitmap);

.NET, :

GraphicsPath path = new GraphicsPath();
path.AddString("Yadda", font.FontFamily, (int)font.Style, font.Size, rect, format);

g.FillPath(..path..)

.

MPG??? , /, .

, BMP-, .NET, , . , CAPTCHA .NET, , .

!

+1

Check out the Adobe Premier API . I'm not sure if there are .NET libraries, or if you need to go around.

0
source

Source: https://habr.com/ru/post/1710627/


All Articles