I have a subtitle file for an AVI which is out of sync by 20 or so seconds, or 840 frames to be more precise. Therefore, I need to edit the frame numbers listed in the subtitle file (it's a textfile).
Simple enough task, or so I thought, until I got bogged down in the pleasantries of sed/awk.
The two sets of numbers in the sample below correspond to the beginning and end frames for displaying the subtitles. What I need to do is decrement all these numbers by 840.
{148360}{148390}Say it!
{148395}{148472}I won't come out|until nobody is around.
{148477}{148561}Good boy, stubborn.
{149220}{149252}Leave!
{149257}{149305}Go away, dog!
{149310}{149356}Go, dog!
{149361}{149430}Leave.
{149705}{149741}Good job, Ferruccio.
{149746}{149829}It works.
{150385}{150471}Is there anyone|called Dora here?
The first line should thus read:
{147520}{147550}Say it!
I'll probably want to be able to run the script on other files, with a different decrement/increment, so the command line will be like:
resynch_sub.sh 220 old.sub new.sub
resynch_sub.sh -840 old.sub new.sub
A bonus point for anyone who can name the film