Adding text to videos using MLT Framework

2019-09-11 18:36发布

I am rendering a video using MLT Framework and am not able to successfully add text using the demos that are included in the code.

When I execute the mlt_my_name_is demo, I receive the following errors:

./mlt_my_name_is 
Failed to load "+My name is Inigo Montoya.txt"
Failed to load "+Prepare to die!.txt"
Failed to load "+You killed my father.txt"
Failed to load "+My name is Inigo Montoya.txt"
Failed to load "+Prepare to die!.txt"
Failed to load "+You killed my father.txt"
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
|1=-10| |2= -5| |3= -2| |4= -1| |5=  0| |6=  1| |7=  2| |8=  5| |9= 10|
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
+---------------------------------------------------------------------+
|               H = back 1 minute,  L = forward 1 minute              |
|                 h = previous frame,  l = next frame                 |
|           g = start of clip, j = next clip, k = previous clip       |
|                0 = restart, q = quit, space = play                  |
+---------------------------------------------------------------------+
Current Position:         49

In particular, the documentation states that when a reference to a .txt file starts with + the text should be interpreted directly, but it appears the tool is trying to load a non-existant file instead.

Secondly, I am unable to find extended documentation about placement and formatting of text. The documentation for ProducerPango references a document at https://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html, but this URL returns a 404. Can anyone point me to updated documentation for the Pango producer or to a different producer that serves the same purpose?

标签: pango mlt
2条回答
男人必须洒脱
2楼-- · 2019-09-11 19:27

In addition to Dan's comments, I recommend using the "dynamictext" filter for text rather than the "watermark" filter. dynamictext has the same features, but does not require the "+" prefix and ".txt" suffix on the text. pango and qtext are still required when using dynamictext.

查看更多
趁早两清
3楼-- · 2019-09-11 19:32

You do not have working gtk2 or qt modules. More than likely this is because you compiled it yourself and did not install the corresponding -dev or -devel packages. See this page on the web site about (somewhat dated) dependencies for running the build scripts. You can also install Shotcut and use the melt that comes with it by running Shotcut.app/melt (NOT bin/melt).

MLT can use either the pango or qtext producer to respond to a +....txt input. FFmpeg-based avformat producer is attempted for all inputs as a last resort. When no producer accepts the input, melt just reports the message you saw. It indeed failed to load the input you specified; it does not need to clarify whether it thinks your input is a file name, URL, or markup.

The pango markup format document can be easily located using any web search engine. However, it does not let you adjust the size and position; the producer simply produces text. You need to use other MLT filters such as watermark or affine to control size and position. The size attribute of the text simply controls the size of the textual image created before being placed into a compositing/transformation rectangle.

查看更多
登录 后发表回答