O'Reilly logo

Linux Multimedia Hacks by Kyle Rankin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #52. Add Custom Subtitles to Video

Use MPlayer's subtitle format to add your own commentary to your favorite movies.

When it comes to watching foreign films, I've found there are two types of people: those who prefer subtitles, and those who prefer dubbing. Even though dubbing has come a long way since the days of Godzilla and '70s Kung Fu movies, I still find that I fall into the subtitle camp. I prefer being able to hear the original actors say their lines in their own language. I read fast enough, so following along with the dialogue as it's printed hasn't been a problem for me.

Of course, not every foreign video is subtitled. In fact, there's a rather large movement of fans of certain programs who create subtitles (called fansubs) for them. Many of these subtitles not only contain translations of the dialogue on screen, but also extra explanation for any cultural references that were made, and so on. MPlayer supports its own rather simple subtitle format that you can use to add custom subtitles to your favorite videos. You might use this to add legitimate translated subtitles to a movie, or as you'll see in the section "A Sample .sub File," your own off-the-wall commentary on a movie. Think Mystery Science Theater 3000, but with text.

The MPlayer subtitle format was designed to be particularly easy to create and edit. There are only a few fields to worry about, as you can see from the beginning of this example:

	TITLE=Pulp Fiction
	TYPE=VIDEO FORMAT=TIME 0 2 Welcome to Pulp ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required