DVD Studio Pro Subtitles

dvd iconIf you have used DVD Studio Pro you will know that you can enter subtitles directly in to the app, but when you do it is a job to do anything with them! An alternative is to have someone create a subtitle file for you… the trouble there is they often arrive and are pretty much unuseble since not many folk know how to write them.

I had one such file sent to me this week. The format was .stl and a different version as .txt – both are generally OK to use, but the file content was badly written.

The way you need the file to be set up is to have a start timecode (in the standard timecode format of hours:minutes:seconds:frames) a tab a comma another tab then the end timecode for the subtitle, followed by a tab, comma tab combination before the actual subtitle text itself. It should look something like this:

00:00:15:16 , 00:00:17:13 , Over here, quick… I think I can see it!

So, when I got the following format it presented various challenges:

1: 00:00:15.16 00:00:17.13
Over here, quick... I think I can see it!
2: 00:00:26.13 00:00:30.05
- OK - let me ring the police first!
- The others will be here soon!

I mean, you can see what the writer is trying to give you – they want you to see how the subs should appear on screen, but they have absolutely no idea of the work this now involves. First off, the time code is all wrong. It can either be 00:00:00:00 as a format, or 00:00:00;00 which would indicate ‘drop frame’ time code, which you see a lot in NTSC files from places like the USA. Occasionally the timecode starts at 01:00:00:00, which is OK to use as well.

The challenge is to quickly find and replace all of those full-stops with colons, without changing any full stops in the actual text for the subtitle. In the file I got there were many!

Second is the use of a line numbering system – and using a colon to boot!

Then there is the matter of missing tab marks, commas and the use of line breaks… It really was a mess, and would be a serious contender for making use of a subtitling application such as Belle Nuit. However, all I had was Microsoft Excel and BBEdit (which I don’t use a lot and am not sure of the capabilities).

So, the first thing I did was import into Excel and use the colon as a field separator. I could then remove the line numbering pretty easily. This left the remaining timecode in different columns with one having the seconds and frames in. As long as the excel columns are formatted as text (and not the default ‘general’ format) anything you type will appear as you type it. A quick find and replace in that column changing full-stops for colons should have sorted it, but it caused Excel to add in a further set of characters. Odd, but not too much of an issue. I copied the column and used find and replace in BBEdit instead, copying that back in to the Excel column. I could then copy the split timecode columns in the same way, using BBEdit to concatenate them back into the right format. The code came back in to Excel like this:

00:00:15:16

Perfick!

Next was to sort out the text fields. Saving out of Excel as a .txt file, I reimported it but this time used a space character as the field separator. This gave me a start code, an end code and then a word in each column for each line. I had already removed the line breaks earlier in BBEdit. By copying the columns containing the words and pasting into BBEdit I got a tab character between each word. I could then find and replace those for spaces. All looked good, so I copied it back into Excel and put it into a single column.

The last step was to add a column between the two sets of timecode, and the second timecode and the text. In both of these I used find and replace in Excel to write a comma instead of having an empty cell. Easy.

From here I could simply highlight all of the columns and copy the content into BBEdit, where I ran a few final checks to make sure everything was where it should be. The Excel format ensured there were tab marks between timecodes and commas, so I simply saved and used the .stl extension.

This imported into DVD Studio Pro with no problems, although the same file saved with a .txt extension didn’t work. No matter, as long as one format worked that was all I needed. Job done!

The thing to remember here is that if you have got the subtitles in an external text based file you can easily adjust the time codes or move things around. Excel is particularly useful for this kind of work. However, if you type the subtitles directly in to DVD Studio Pro you will have a job manipulating them at any level.

Too late? You already have typed them in to DVDSP? OK – it’s not dreadful. Export an item description for the track and use the nifty ‘Subtitler’ app from version tracker to import your file. You can then export a valid .stl file from there and save that for future use.

13 thoughts on “DVD Studio Pro Subtitles

  • 23 July, 2007 at 1:04 pm
    Permalink

    Hi Hal,

    I’ve authored a DVD on Studio Pro. I entered the subtitles manually and they simulate fine and, when playing the burned DVD, look great on the Mac and on a portable player I have but when someone’s played them on their widescreen TV, they say the bottom part of the subtitles disappears off the bottom of the screen. Without moving them to centre-screen, which would make them look odd on the players that don’t cause this problem, what else can I do?

    The video’s 16:9 anamorphic and the DVD’s set to play in 16:9 letterbox. He says he tried all the different settings on his TV and it didn’t help. On another widescreen TV they tried it on, the subtitles are all visible, just displaying over a black band at the bottom of the screen.

    In the Viewer they all were within the Titlte Safe area.

    Is it possibly a one-off, something to do with his TV/player? Is there something else I should have done in Studio Pro? I’ve always worked on Sonic Creator before, this is my first time using Studio Pro. I’ve gone through the manual with a tooth comb and can’t find anything else I should have done or could change.

    (I have thought of making them smaller but don’t seem to be able to change the font, although I’ve done what the book says and changed it in the font box that comes up and clicked ‘apply to stream’ but nothing. I’ve even tried adding subtitles to a brand new stream, having changed the font/size in that box and clicked every ‘apply’ button I could see there and in the Inspector but it changes nothing. Apart from which, they look great at the size they are.)

    Please help (soon, if you can!)

    Laura Caen

    If you do make calls to people and can call me, I’ll gratefully call you back. Thanks

  • 23 July, 2007 at 1:29 pm
    Permalink

    Hi Laura – I’ve emailed you directly… and removed your phone numbers from public gaze 🙂

  • 27 March, 2008 at 1:34 pm
    Permalink

    If you were lazy, you could also use Perl, which is installed by default on any decent OS (like Mac OS X or any other flavor of Unix):

    perl -0777 -pe ‘s/^\d+:\s+//gm; s/((?:\d{2}:){2}\d{2})\.(\d{2})/$1:$2/gm; s/\n/ /g; s/((?:(?:\d{2}:){3}\d{2} ){2})/\n$1/g’ test.txt

    De-obfuscating this is “left as an exercise to the reader”…

    (truly lazy people learn some Perl and regular expressions.)

  • 9 April, 2008 at 10:40 pm
    Permalink

    LOL – thanks for that Albert – RegEx are very useful, but I’ve not yet mastered them… perhaps I ought to learn a little Perl too… could be a good thing to do!

  • 24 April, 2008 at 1:37 pm
    Permalink

    I’m having the same problem as Laura. I’ve made subtitles, framed them nicely on my 16:9 video, but when I play back on a widescreen TV (or a pro 4:3 monitor) the subtitles drop off the bottom of the screen. Playback fine on computers. Any ideas? Is there a quick fix, or do I have to re-export everything letterbox?
    help!

  • 25 April, 2008 at 8:19 am
    Permalink

    Hilleke – are you burning the subs into your video or working with them as a sub picture stream? If you are doing the latter then you can adjust the vertical position of them.

    If the former then you will need to do one of two things – firstly, go back to your FCP timeline and turn on the title safe overlay guide, and check that your subs are within it. If they are then you may find that the TV is ‘zooming’ the image in order to give you full screen. Adjust the TV settings. If they are out of the safe zone then I’m afraid you will probably need to re-do them.

  • 5 August, 2008 at 2:20 pm
    Permalink

    This comment has been moderated to remove the bad language.

    Albert, wrote:

    “If you were lazy, you could also use Perl, which is installed by default on any decent OS”

    Yada yada yada AS IF the average person is capable of whipping up some perl commands out of thin air. Why not tell everyone they can download some ancient ALGOL or FORTRAN compiler and write their own app to do the job!

    “De-obfuscating this is “left as an exercise to the reader”…”
    And what about debunking your buggy code as USELESS.

    Yes, IT DOESN’T WORK AT ALL. and like everyone who is pretentious enough to make posts like yours, you didn’t ACTUALLY BOTHER TO TEST IT DID YOU?

    No, you just came here and posted to make yourself look as if you were smarter than you already are.

    Next time you cross the street, I HOPE TO GOD someone steps on the gas and runs you over. The last thing the planet needs are VERMIN such as yourself!

  • 6 August, 2008 at 6:29 pm
    Permalink

    Well Peter – you seem to have a bee in your bonnet about this.

    Yes, Albert posted some elusive code and perhaps that has helped some people. It clearly hasn’t helped you any. However, considering that Albert at least pointed out that there were other ways to deal with the issue I faced at the time, I think he deserves a tad more than the harshness you wrote. OK, Perl isn’t for everyone, maybe somewhat obsolete and the code above may contain bugs… but it shows an alternative. I do agree with you that if it doesn’t work you are entitled to make your feelings clear.

    I removed the swearing – there was no need for that, IMO – but left the sentiment of your post. What I would ask though is that we keep it constructive, please. Did you have a particularly tricky subtitle file to sort out?

  • 14 August, 2008 at 1:40 pm
    Permalink

    Peter, it seems that until now, nobody decided to step on the gas pedal and run over me. So I’m afraid the vermin is back…

    If you had trouble with that Perl command-line, you could have told us what the problem was, so everyone could benefit from the solution. Of course, that is much less fun than insulting people. I also indulge in that sort of fun occasionally, but today I feel boringly constructive.

    So for anybody else, who doesn’t have a specific aversion to terminal commands:

    There appear indeed to be two problems with my quick-and-dirty command:

    1. This blog software took the liberty of replacing my single quotes by another character. When I copied from this blog post to paste back into a terminal, I got dots instead of single quotes! Of course, that doesn’t work.

    2. According to this blog post, the time codes and text need to be separated by “tab comma tab”, and not by a single space as in my example.

    So: the perl commands between “perl -0777 -pe ” and your file name at the end need to be enclosed in single quotes. Here is a corrected version, which uses equal signs instead of single quotes, so the blog software will hopefully not mangle it into something else. Replace the 2 instances of “=” with a single quote in your Mac or Linux terminal. In Windows, use double-quotes instead.
    And of course, adjust the input and output file names.

    perl -0777 -pe =s/^\d+:\s+//gm; s/\s*((?:\d{2}:){2}\d{2})\.(\d{2})/$1:$2\t,\t/g; s/\n/ /g; s/((?:(?:\d{2}:){3}\d{2}\t,\t){2})\s+/\n$1/g;= YOUR_FILE_NAME > YOUR_NEW_OUTPUT_FILE

    This is the output of that perl command, when given the sample in the original blog post:

    00:00:15:16 , 00:00:17:13 , Over here, quick… I think I can see it!
    00:00:26:13 , 00:00:30:05 , – OK – let me ring the police first! – The others will be here soon!

    It is on 2 lines, and has tabs around the commas (instead of the double-spaces in this post).

    “AS IF the average person is capable of whipping up some perl commands out of thin air. Why not tell everyone they can download some ancient ALGOL or FORTRAN compiler and write their own app to do the job!”

    No, not everybody is expected to be able to whip up some scripting commands. But almost everyone knows someone who is. And unlike old compiled languages, the beauty of scripting languages is that you can just copy/paste commands which you were sent by email or saw on a web site. And they have a good chance of working as-is on whatever platform you happen to be on. That is, if you know how to copy and paste commands into a terminal window. If you don’t and can’t be bothered to learn, it’s OK too: there are plenty of software companies willing to take your money and give you idiot-proof GUI wrappers around trivial commands.

    And finally, for anybode who might care, and since I’m in a terribly didactic mood, here is a longer multi-line listing with comments, which could be pasted into a script file (I hope this doesn’t get mangled into a mess by the posting software):

    #!/usr/bin/perl -0777 -p

    # convert weird subtitle format into some other weird subtitle format

    # “-0777” above forces perl to read the whole argument file into a single variable
    # instead of processing it line by line.
    # “-p” makes it print the result to STDOUT.

    # at start of lines, remove numbers followed by colon and space(s)
    s/^\d+:\s+//gm;

    # replace TC with dot before the frames
    # with TC using only colons,
    # and add “tab comma tab” after it
    s/\s*((?:\d{2}:){2}\d{2})\.(\d{2})/$1:$2\t,\t/g;

    # replace newlines with spaces
    s/\n/ /g;

    # insert a newline before any pair of “timecode tab comma tab”
    s/((?:(?:\d{2}:){3}\d{2}\t,\t){2})\s+/\n$1/g;

    Of course, this is only for the impatient and lazy. Peter will buy expensive software for it, or buy BBEdit and Excel, and work hard to convince a spreadsheet and a text editor to cooperate and do 4 regular expressions for him… 🙂

  • 22 October, 2008 at 9:05 am
    Permalink

    The subtitler app is nowhere to be found on the internet. Try Subtitle Xtractor from http://www.truevision-video.de/ instead. I did have to use another app afterward to change the text coding from Mac Roman back to UTF8.

  • 23 October, 2008 at 8:26 pm
    Permalink

    Subtitler was removed as it is not compatible with OSX Leopard, I believe. There are alternatives appearing, so thanks for the link, Misja.

  • 12 May, 2009 at 3:44 pm
    Permalink

    Hi Hal,
    I am having the same problem as Laura (above) with the subtitles disappearing when the film is letterboxed and played on a TV but fine when played elsewhere. Wondering what you recommended to her.
    thanks!

  • 25 January, 2010 at 10:30 pm
    Permalink

    I’m having a problem with subtitles.
    I’m using DVD studio Pro 4, imported the movie, 1080 HD, made de subtitles directly (4 languages), 2 menus, 1 for play and subtitles, the other just for the different subtitles. When I use simulate, it works perfect!
    The menus, the subtitles, everything works great!
    When I burn the dvd and then try it, horror happens! The movie starts without showing the 1 menu, and, by default or whatever, only appears the 1st subtitle language! Even when I try to change to the others, they don’t appear.
    I checked everything, subtitle stream , checked for view in every languages… I don’t know what is happening! please advise. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

18 + 14 =