sachac / subed

subed is a subtitle editor for Emacs
179 stars 16 forks source link

Describe workflow for converting a series of lines like "2:34 foo bar" to subtitles? #40

Open edrx opened 3 years ago

edrx commented 3 years ago

Hi subed people,

this is similar to Issue 15, but different enough to deserve a new thread...

So, question: I am learning subed now. I have subtitles for parts of some videos in an improvised format - in which each line is just a timestamp followed by text, like this: "14:01 So I took a look at the man page for xpdf" - and I would like to use subed to convert that to the SRT format. I can try to write a Lua script to do that conversion for me, but is there a more subed-ish way to do that? Here is a VERY rough idea to start with: we would use a keyboard macro that supposes that we are in a two-window setting with .srt at the left and the improvised subtitles at the right; each time that we run the keyboard macro it would run `subed-insert-subtitle' in the .srt window, copy one line from the right window to the left window, and it would somehow use my timestamp - the "14:01" in the sample line above - to set up the start and the stop time of the subtitle...

My problem is with the step "and it would somehow use my timestamp" above, of course. Besides that I was mind-blown by how easy it was to set up subed here... really, really, really good job, Random User, Sacha, and others! =)

Btw, here is an example of these improvised subtitles: http://angg.twu.net/emacsconf2019.html

rndusr commented 3 years ago

Thank you for the kind words. :)

There is probably a better way, but I would use a macro (or multiple macros) to convert your simple format to srt. You can do that in multiple steps, e.g. add an empty line between each subtitle first, then insert " --> " after each timestamp, then copy the start timestamp after the " --> ". The IDs can all be "00" and subed should fix them when you save. You don't need any special mode to do that, just Emacs.

After that, you could probably use subed-increase-stop-time in another macro to give each subtitle a default length, e.g. 1 second.

You'd have to go through manually to synch each subtitle. I've seen projects that claim they can automatically synchronize subtiles from the audio video, but I've never tried it.