Adding hard subtitles to your film

Film festivals usually require to have the subtitles "burned into" the film. Here's a recipe how to do that. I'm using Sony Vegas but I'm sure it will work with any NLE as long as it can import mpeg2. I've done that partially under Linux but you can also do the same procedure under Windows.

I've used mencoder with a script and a simple C++ program.

  1. Use a subtitle editor to generate your subtitle file. I've used subtitleeditor which is part of the standard Ubuntu distribution. However, you can also download the source code and compile it by yourself. I haven't found any working subtitle editor under Windows though but perhaps somebody can point me to one. Cruical is that you generate a subtitle file which is compatible with mencoder. As for as I know mencoder reads more or less everything. Make sure that your subtitle files are utf8 encoded.
  2. Download mklist.cpp and compile it with gcc -o mklist mklist.cpp (or gcc -o mklist.exe mklist.cpp under Windows). mklist takes one argument and that is the lenghth of the film in minutes. For example, type "./mklist 5" if your film is 5 minutes long. This generates an index file (list.txt) which contains links to one png file which is called black.png. It basically contains for every frame a link to the file black.png. Here is an example for such a png file for HD 1920x1080. This file serves as the background for the subtitles.
  3. Start the script mksubmovie.sh with two arguments (or type in by hand: mencoder -of mpeg -ovc lavc -lavcopts vbitrate=100:aspect=16/9:vcodec=mpeg2video -sub MYSUBTITLES.SRT -subfont-blur 4 -subwidth 90 -subpos 90 -fontconfig -font 'Bitstream Vera Sans' -subfont-text-scale 2 -ass-force-style FontName=Default.Bold=1 -subcp utf8 -o MYOUTPUTFILE.MPEG -mf fps=25 mf://@list.txt). The first one is the name of the subtitle file and the second is the generated mpeg2 film which contains the subtitles on a black background. For example: sh mksubmovie.sh helen44_06_utf.srt helen44_06_utf_sub.mpg generates the mpeg file helen44_06_utf_sub.mpg from the subtitle file helen44_06_utf.srt.
  4. Finally open your vegas project. Add a video track as track one and import your mpeg2 file with the subtitles. Then click on effects and add a mask or chroma key. Adjust the threshold and your should see the subtitles on top of your film. Then render to your favourite output format.

back to Bernd Porr's homepage