Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: subtitling DFTalks  (Read 662 times)

Lac

  • Bay Watcher
    • View Profile
subtitling DFTalks
« on: April 24, 2011, 07:34:48 pm »

PS  I wonder how long it will be before you can stick the audio and Mallock's transcription into an app and have it sync the two together with read-along highlighting and audio bookmarks!  sigh.

I decided to research my own musing.

I didn't seriously expect to be able to just merge audio and text using freeware voice recognition software; hopefully one day that'll come.  But I knew that something ought to be possible.

My first googling did uncover an interesting utility (Kerensky's SAS 0.6.1) that took the audio as an input, and split it on natural pauses into subtitle-friendly chunks (but not using any text file).  I guess I could have then written myself a utility to help chop up Mallock's text files to match the audio slices.  But I had no idea how to write something that would allow control of the audio in such a way to make that painless, so I gave up on it.

My googling then started to turn up subtitle editors.  Such as SubStationAlpha/Easy Subtitles Synchroniser/SubResynch...and my favourite (because it seems more modern and streamlined): Media Subtitler.  SubStationAlpha is powerful but was written in a time when a computer couldn't play an audio file and do anything else at the same time - so its default is to play the audio external to the computer!

All these required an existing subtitles file (or you typed every word yourself!), and helped you synch it to the audio.

So I needed to turn Mallock's text file into subtitle fragments.  I couldn't think of anything to Google for this, so I made the classic mistake of 'how hard can it be, I'll code it myself'. In hindsight I wish I had at least stumbled across Knuth's line breaking algorithm before I'd started (PS if anyone has that paper, I'd be interested in a copy, I can only find links that require registration, but it sounds tantalising).

As far as I could see, there are a lot of different subtitle formats, but they all stick to just 2 lines (I had hoped for StarWars style scrolling narrative).  And you can adjust the font to get as much text in the line as you want, compromising text size.  So I randomly picked 60 characters per line, on the basis that if you make it too short then there's more synching to do plus less reading ahead for the reader.  In hindsight I may have gone a little too long, and perhaps 50 per lines might be better.

So I spent as many hours as could probably have hand-crafted subtitles for all 12 podcasts, writing a VBA app (yeah I know ... but its so quick to get started and has pretty good string handling facilities).  Remember the first lesson in computing is that it isn't really there to make slow jobs quicker, its there to make tedious jobs more fun!

You just run the VBA macro (I used Excel, but there's nothing Excel specific in there).  The input and output files are hardcoded.  The input file should be Mallock's DF transcript.  The output is a text file with max 60+"|"+60 lines which tries to break on natural sentences breaks such as punctuation or conjugations.  I don't claim it to be 100% (e.g. laugh at the mess it makes of the web address in DFTalk#13); I can't even guarantee/prove it never exceeds 60 characters.  But I done #12 and #13 and it seems reasonable.
VBA macro: http://dffd.wimbli.com/file.php?id=4272

Then I used Media Subtitler to synch the lines to the audio.  Unfortunately I gave up on the waveform facility (which required converting the mp3 file to wav), because it seems to get out of synch over time; and near the end - when its most useful at the bonus section - it is many seconds out of step.  But you just listen to the audio (sorry, you do have to listen to the whole podcast at least once, realtime ;) ) whilst on 'manual mode', and press 'next' every time the voice reaches the end of the displayed subtitle.  (And curse if you make a mistake, because it's a kerfuffle to get it together again).

And bingo, you're finished file - which I tend to save as the simple '.srt' format.  Although there are plenty of others.

To use it:
I think Windows Media Player might only be able to subtitle video.  But in my exploring I had already downloaded VLC in order to convert formats (it will actually convert audio to blank video), and that accepts my '.srt' file fairly nicely.  You have to use 'advanced open file' and check the subtitles option (and browse the file) - and then, the non-obvious bit, you have to select a 'visualisation'.  I don't think you can have just a blank screen plus subtitles!  But something like the spectrometer actually adds rather than subtracts to the experience.
I've attached a link to my '.srt' file for #13 if you don't want to /can't run the VBA macro.
finished .srt file: http://dffd.wimbli.com/file.php?id=4271

I've started playing with a version 2 that generates weights for each possible breakpoints and breaks on the 'best'.  But its such a pain to tweak both code and parameters (much more fun to play with code than to keep rerunning with 0.1 tweak to a number).  In fact its so tedious I might give up on it.

/ramble

Lac.




Logged