|
|
Thread Tools | Display Modes |
04-10-2008, 11:48 AM | #1 | ||
Looking for help with text-editing script
Hello!
I'm looking for someone with knowledge of a programming or scripting language (doesn't matter which one) for a small-time text editing job. My problem is: I was making subtitles for a movie with a sub-making program, when something odd happened. Somehow the timing and the texts got messed up, desynchronized. I need someone to help me synch it back again. For those, who are not familiar with the format of .srt files, here is a sample: Code:
967 01:18:20,597 --> 01:18:23,854 Well, as history has shown, nothing was further from the truth. My actual problem is: the editor somehow messed up the relation between the text and the timings, essentially shifting the texts forward to the next timecode. So, timings and durations remained the same, but it displays the wrong texts, it always displays the previous line. There is no feature in my sub-editor (or in any sub-editor, that I know of) to shift the texts back in place. So I either do it by hand, one line at a time, or I don't. And doing click-->crtl+X-->click-->crtl+V will drive me crazy, if I have to do all the 1463 lines by hand, one-by-one. This is what I need help with. A small script or whatever, that copies the TEXT from the next timecode, and pastes it back into it's place, then does this for all the remaining lines, so the subtitle comes back into synch with the timecodes, like this: For somebody, who is moderately proficient in some scripting or programming language, this shouldn't be too hard, I guess. Please help me!
__________________
The Master of Light and Darkness "Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!" BEWARE: I'm using the forums as a personal blog! |
|||
|
|
04-10-2008, 01:14 PM | #3 | ||
Quote:
um...lets put it like this: take two pieces of paper, put them beside each other so they touch. Now draw horizontal lines across the two papers, starting at the left side of the left paper and ending on the right side of the right paper, repeat this all the way to the bottom. Now write some time intervals (ex. "1:12pm to 2:32pm") on the lines on the left paper and write some text on the lines on the right paper. Now, slide the right paper down by one line, so the second timecode in the left paper comes in line with the first text on the right. THAT is my problem. See, the timings and the intervals are all correct, but they have the wrong text to display, a one line lag. Now, all the subtitling programs I encountered have delay and sync features, but that's not what I need, because one line of subtitle and it's timecode are treated as one unit. Each line has it's timecode, and they are one unit of subtitle as far as the program is concerned. I can adjust the timing of ALL the wrong lines at once so the first one start to display at the intended time, but that, because the lines and their respective timecodes are being treated as a unit, won't do anything good, because the INTERVALS are still wrong. You have that two papers still on the desk, align them again, first timecode to first line of text. Get another piece of paper, and put it beside the right one on the desk so they touch. Now you have 3 pieces of paper beside each other. Extend the lines to this new paper, and draw some pictures on the lines. This is the movie. Now slide the central paper (with the texts on it) down one line. Now you can see my problem. The timing is okay, but the wrong text is displayed. What the delay and sync feature in the programs does, is adjusting the text together with it's display interval. Now for the sync and time adjust: touch the left and the center paper, and slide them, TOGETHER, up or down, along the 'movie' paper. THAT'S what that feature does, but as you can see, it does not help my case, you see, because the start and end times of the subtitles are NOT IMPORTANT, just the INTERVAL, in which they are displayed. Um...like this: you have your first line display two words for 0,5 sec, and the second line display two sentences for 5 sec. But it shifts one interval, so now it displays your two words for 5 sec, and your two sentences for God knows how long. Am I making any sense here?
__________________
The Master of Light and Darkness "Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!" BEWARE: I'm using the forums as a personal blog! |
|||
|
|
04-10-2008, 01:35 PM | #4 | ||
Join Date: May 2005
Location: Nitra, Slovakia
Posts: 6,533
|
oh, well i don't have any time to look at it right now, but if you have delphi7 that proggie is open source. and it has already preprogrammed classes for reading those blocks of text in srts, when it changing. if you could dig around it and move the text strings instead of changing the time, or changing those times to the previous value 1 position behind it, i guess it wouldn't have to be so difficult
__________________
Last edited by _r.u.s.s.; 04-10-2008 at 01:37 PM. |
||
|
|
04-10-2008, 03:10 PM | #5 | ||
If only I knew how to program in Delphi7
If I knew any programming or scripting languages that well, I would've done it myself, but sadly, I'm still only learning them, and the most complicated programs I can write are either display colored lines on the screen, or calculate something in the console window. Manipulating strings and files, and working with dense arrays are still beyond my abilities at this time. I COULD write the pseudo-code for the script/program, but I can't program it myself. I think a sequential algorithm would work: Code:
OPEN file X=0 IF search string "-->" returns result THEN: move pointer to location go down one line ELSE: msg: "Wrong file" END PROGRAM END IF REPEAT UNTIL X=1 IF search string "-->" returns result THEN: move pointer to location go down one line record location to variable SP IF search string "-->" returns result THEN: move pointer to location go down one line REPEAT UNTIL encountering an empty line record actual line to array L DELETE actual line END move pointer to location SP REPEAT UNTIL encountering an empty record in array L insert respective line from array L to this location new line END ELSE: END PROGRAM END IF ELSE: X=1 END IF END SAVE file CLOSE file msg: "finished" END PROGRAM
__________________
The Master of Light and Darkness "Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!" BEWARE: I'm using the forums as a personal blog! |
|||
|
|
04-10-2008, 03:19 PM | #6 | ||
Join Date: May 2005
Location: Nitra, Slovakia
Posts: 6,533
|
easier would be storing the line containing the times (-->) and then replacing the next one with it
__________________
|
||
|
|
04-10-2008, 03:35 PM | #7 | ||
...now that you mention it
But even if I know the algorithm and the pseudo-code, I don't know any programming language well enough to make it work...
__________________
The Master of Light and Darkness "Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!" BEWARE: I'm using the forums as a personal blog! |
|||
|
|
05-10-2008, 10:51 AM | #8 | ||
Join Date: May 2008
Location: Waterside, South Africa
Posts: 3,138
|
Why don't you just use a video editing programme? It's what i'm learning to use... *drools at prospect of her own Liquid system w/ 3 screens and 4 speakers.*
|
||
|
|
05-10-2008, 11:50 AM | #9 | ||
Join Date: May 2005
Location: Nitra, Slovakia
Posts: 6,533
|
video editing program? o_o he wanted to modify text strings in his srt, why would he edit video
__________________
|
||
|
|
05-10-2008, 03:52 PM | #10 | ||
Okay, using _r.u.s.s.' idea, I created another pseudo-code, which replaces the timecodes instead of the subtitles themselves. Here:
Code:
OPEN file X=0 IF search string "-->" returns result THEN: move pointer to location record line to variable T1 delete line insert "00:00:00,000 --> 00:00:00,001" go down one line ELSE: msg: "Wrong file" END PROGRAM END IF REPEAT UNTIL X=1 IF search string "-->" returns result THEN: move pointer to location record line to variable T2 delete line insert line from variable T1 move down one line IF search string "-->" returns result THEN: move pointer to location record line to variable T1 delete line insert line from variable T2 move down one line ELSE: X=1 END IF ELSE: X=1 END IF END SAVE file CLOSE file msg: "finished" END PROGRAM Because the, fist line's timecode will be used as the second and the second's as the third...etc, I inserted a dummy timecode to the first line. By later deleting that line in-program, the indexing problem will be solved too. A little help here?
__________________
The Master of Light and Darkness "Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!" BEWARE: I'm using the forums as a personal blog! |
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Castlevania movie script revealed | TheChosen | Blah, blah, blah... | 16 | 18-07-2008 06:41 PM |
Abandonia Script? | jourdan | Old Suggestions | 4 | 09-07-2007 09:24 AM |
Script Not Working After Migrate | Reup | Old Suggestions | 1 | 25-08-2006 11:58 AM |
Annoying Script Prompt -RESOLVED | guesst | Old Suggestions | 7 | 28-07-2006 01:00 AM |
|
|
||
  |