VideoHelp.com forum archive
http://www.supermediastore.com/



Forum Archive Home -> Linux -> Command line text overlay tool



Command line text overlay tool
lmundy posted 2008 Jun 24 00:38
I'm looking for a tool (or tools) that will run under linux (debian, specifically) that is capable of overlaying dynamic text to a video via a command given from the command line. This would be in similar to subtitles, but I require more flexibility.

To give you an idea of what I'm after, I'll describe what I currently have set up.

I work for a football club. Each week a game is filmed and we are given avi (divx) files to do with what we like. I've written a handful of scripts which automate cutting/joining of these files at the coach's request (using mencoder). For example say the coach just wanted 3 clips cut from the game video from 1:23 - 2:16, 14:32 - 14:55 etc...

This is all working fine and great and it's really handy.

What I'd like to be able to do now is overlay various text elements onto the video. To start with, I wanted to be able to display a time stamp of the current game time on the video. So the script would be given the current game time from when the clip starts and the current game time when the clip ends. It would then obviously do any calculations necessary and generate the required command(s) needed to overlay the text.

So just to summarise...
Script inputs:
- Multiple start/end times from parent video (to be cut) eg 10:23 - 10:45
- Current game time associated with each of the above video times eg 12:15 - 12:37

Script outputs:
- Commands to cut/join all the clips with a text overlay displaying the current game time.

(If more explanation is required let me know, I hope you understand)

I tried having the script create .srt files and embedding them using mencoder, I couldn't get this to work properly but this is a rather inflexible option as it's not practical to change absolute positioning, text font/color etc. (from what I can gather mencoder has a vertical position option for subtitles with a few arbitrary font options).

I've also tried using ffmpeg and the imlib2.so vhook, but this method only allows static text overlays which makes putting a specific timecode on a video difficult. What I originally did was generated a command that updated every second with a new -ss and -t option for each second. This method wasn't practical as it broke up each clip further into 1 second clips which then have to be joined together again but I guess if I can't find a better way I'll have to stick with it.

Does anyone have any other ideas?



guns1inger posted 2008 Jun 24 00:46
I foresee at least one major problem with your solution - complete freedom of text to be overlaid will most likely result in the need for re-encoding the video.

That said, it is possible to run avisynth under wine, so I believe. Avisynth is ideal for most of what you want to do, up until the output, which will be uncompressed video and will have to be encoded to a more suitable format.



lmundy posted 2008 Jun 24 00:48
Thanks for the speedy reply!

Re-encoding the video isn't really a problem.

Am I able to invoke AviSynth via the command line (or via a script?)



jungle5150 posted 2008 Jul 13 13:58
I've used cinelerra for video editting. The learning curve is steep, and it's way more powerful than what you need, but it's a great tool. You might get some more ideas of cool things to do with the video by using it. It's gui based, but there might be a scripting language. I'm not sure.

Let me know if you want a tutorial video, I can send it to you. Actually, I'm not sure I know how to do a clock (changing text). But if you had a video of one, you could overlay it.

bill




Login/Register to our forum to be able to post here.








About   Advertise   Forum Archive   RSS Feeds   Statistics