generating titles and subtitles from text files

Hello,

[Somewhat long post]

First of all congratulations on Kdenlive. It's easy enough for me to work with, and complex enough not to limit my creativity all too often.

In my latest video experiment, I wanted to add subtitles. Lots of subtitles. I didn't want draw each title manually using the title clip feature, so i wrote a python script that transforms lines of text into transparent .png drawings with titles/subtitles (by calling imagemagick to do the hard work). These clips then have to be inserted in the timeline manually. Once they have been inserted, you can regenerate them from the text files (e.g. to correct spelling errors, or to use a different language) and you're ready to re-render.

I think it shouldn't be too difficult extend this to generate .png files from existing subtitle file formats like *.srt or *.sub.

This script has taken away much of the time that is required to define titles/subtitles for me, but I'm dreaming about improving/extending it as follows (and I'd appreciate some advice in doing so):

Ideally, not only .png clips are generated from a text specification, but they are also inserted in the timeline based on time annotations (and perhaps also a default composite transition can be added to it to make it blend in with the video). For this to happen, right now I basically see two options:

1. the tool is completely separate from kdenlive; it reads the .kdenlive file, updates it as required behind kdenlive's back, and then finishes. The user has to reload the .kdenlive file to see the changes.

Pro: the tool can remain completely in python, remains completely decoupled from kdenlive

Con: the tool has to understand the file format used by kdenlive (which may evolve incompatibly at some point in time?), and has to somehow be aware of any implicit assumptions kdenlive may have made about its contents. The tool thus easily could get "out of sync" with the kdenlive distribution.

2. some kind of plug-in mechanism is used to communicate between the tool and kdenlive.

Pro: better integration with kdenlive is possible, leading to better end-user experience; if a well defined api can be used, there's less chance of sudden incompatibilities later on

Con: requires coding in C++ and requires being able to compile kdenlive, making contributing harder, the learning curve is steeper. Moreover, from what I read on the forum, the plug-in mechanism hasn't fully stabilized yet(?).

So now for the questions:

1. Are people interested in a tool like this? I'd be happy to share what I did so far, and explain how I use it.

2. Is one of my approaches the way to go? Or do you see other possibilities?

For your comments...

 

Scripting is a very important part of a movie. 

  • First, it can help organize and edit the final film. When you submit a project, you usualy need 10% of the film and a minimal sript. So when you listen to your rush, it is better to script important issues.
  • Second it can be used to subtitle films. So in any cases, subtitles are quite important.

IMHO, the only way to go is to manage subtiles directly in MLT. Maybe Dan has some ideas.

What I would love in Kdenlive is to be able to position subtitles in the original clips (I mean project tree), so that I can drag and drop, cut, etc ... viewing subtitles as "markers". Text markers would be a good name.

In the project tree AND in the timeline.

I don't have any idea how other softwares manage text markers. After approval of the Hadopi law in France against illegal downloading, I burnt my legal copies of Windows, Office, etc ... There is no way I can try any Windows software to dig for ideas.

Kind regards,
Jean-Michel

from frame for second and from the time you can get the number of frames

so when you get that you have done .

you need only of a little script that translate srt file in a series of titler each with subtitle . you can take the time and the duration of each subtitle and you can translate into frames and so you are able to put them in the right place in the timeline.

i have done that for my automatic slide show script . actually i am porting it from 0.6 kdenlive to 0.7 kdenlive

Currently, text files can be rendered with MLT, but it's using pango to render the text and the layout possibilities are rather limited if I am right. I tried to work on a Qt based text producer for MLT but it does not seem possible.

So in my opinion, the best thing would be to support subtitles at the Kdenlive level.
I guess the easiest way would be to turn the subtitle file into a wesltey file, creating one image for each title.

Adding real scripting possibilities in Kdenlive is on my roadmap for the next release (0.8.0). I want to add Kross support, which means that plugins can be Python, javascript or C++.

The subtitle script could allow users to change the subtitles text and timings and choose a layout template for them.

When Kdenlive 0.7.3 is released (next week), I will take a more careful look at Kross.
regards

There are currently two entries in Kdenlive Mantis for proper subtitling features.

http://www.kdenlive.org/mantis/view.php?id=1887

http://www.kdenlive.org/mantis/view.php?id=400

With one person even going so far to come up with mock ups.

http://www.project-insanity.org/2012/02/mockups-for-kdenlive-subtitle-ed...

Can we get some more support on these entries so that this feature appears in a version of Kdenlive sooner rather than later. Manually creating, and positioning titles for an entire video creates a lot of extra work.