An easy way to create such subtitles is to use ffmpeg2theora, which can create Kate streams from SubRip (.srt) format files, a simple but common text subtitles format. ffmpeg2theora 0.21 or later is needed.
At its simplest:
ffmpeg2theora -o video-with-subtitles.ogg --subtitles subtitles.srt video-without-subtitles.avi
Several languages may be created and tagged with their language code for easy selection in a media player:
ffmpeg2theora -o video-with-subtitles.ogg video-without-subtitles.avi --subtitles japanese-subtitles.srt --subtitles-language ja --subtitles welsh-subtitles.srt --subtitles-language cy --subtitles english-subtitles.srt --subtitles-language en_GB
Alternatively, kateenc (which comes with the libkate distribution) can create Kate streams from SubRip files as well. These can then be merged with a video with oggz-tools:
kateenc -t srt -c SUB -l it -o subtitles.ogg italian-subtitles.srt oggz merge -o movie-with-subtitles.ogg movie-without-subtitles.ogg subtitles.ogg
This second method can also be used to add subtitles to a video which is already encoded to Theora, as it will not transcode the video again.
When configuring how to rip DVD tracks, any subtitles will be detected by Thoggen, and selecting them in the GUI will cause them to be saved as Kate tracks along with the movie.
oggenc -o song-with-lyrics.ogg --lyrics lyrics.lrc --lyrics-language en_US song.wav
So called 'enhanced LRC' files (containing extra karaoke timing information) are supported, and a simple karaoke color change scheme will be saved out for these files. For more complex karaoke effects (such as more complex style changes, or sprite animation), kateenc should be used with a Kate description file to create a separate Kate stream, which can then be merged with a Vorbis only song with oggz-tools:
oggenc -o song.ogg song.wav kateenc -t kate -c LRC -l en_US -o lyrics.ogg lyrics-with-karaoke.kate oggz merge -o song-with-karaoke.ogg lyrics-with-karaoke.ogg song.ogg
This latter method may also be used if you already have an encoded Vorbis song with no lyrics, and just want to add the lyrics without reencoding.
KateDJ (included with the libkate distribution) is a GUI program using wxPython, a Python module for the wxWidgets GUI library, and the oggz tools (both needing installing separately if they are not already).
The procedure consists of:
It is worth noting that an event may not have attached text, so it is possible to create an empty timed event with attached metadata.
For instance, let's say we have a documentary, with footage from various places, as well as short interviews, and we want two things:
You can then create an empty Kate event for each footage part, synchronized with the footage, and attach a new metadata item called GEO_LOCATION, filled with latitude and longitude of the place the footage was shot at. Similarly, for each subtitle event, a metadata item called SPEAKER can be attached.
An empty event to tag a long 4:20 footage shot in Tokyo on 2011/08/12, and inserted at 18:30 in the documentary could look like:
event { 00:18:30,000 --> 00:22:50,000 meta "GEO_LOCATION" = "35.42; 139.42" meta "DATE" = "2011-08-12" }
Here's a example for a line spoken by Dr Joe Bloggs at 18:30 into the documentary:
event { 00:18:30,000 --> 00:18:32,000 "Notice how the subtitles for my words have metadata attached to them" meta "SPEAKER" = "Dr Joe Bloggs" meta "URL" = "http://www.example.com/biography?name=Joe+Bloggs" }
Notice how another metadata item, URL, is also present. The application will have to be aware of those metadata in order to do something with it though. Since those are free form, it is up to you to think of what metadata you want, and make use of it.
Note that metadata may be attached to other objects, such as regions. This way, you can for example create a region tagged with a name, and track a person's movements with that region. Or you can tag a bitmap with a copyright and a URL to a larger version of the image.