Synchronizing Subtitle track


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Synchronizing Subtitle track
# 1  
Old 10-03-2011
Synchronizing Subtitle track

Hi,

I have a subtitle track something like this.

Code:
1
00:01:18,700 --> 00:01:20,660
Hi.

2
00:01:27,040 --> 00:01:30,380
-How'd it go?
-Lousy.

3
00:01:30,460 --> 00:01:34,300
Got a '63 Thunderbird
I would've sold in a day a year ago.

4
00:01:34,330 --> 00:01:37,050
Now they just wanna look at the pictures.

5
00:01:37,470 --> 00:01:39,840
You smell nice.

6
00:01:44,140 --> 00:01:45,680
How was your day?

7
00:01:45,890 --> 00:01:47,480
It was great.



I want to add few seconds to the time frame. like 30 seconds
00:01:18,700 --> 00:01:20,660
should become like
00:01:48,700 --> 00:01:50,660

and

00:01:44,140 --> 00:01:45,680
should become like
00:02:14,140 --> 00:02:15,680

and

00:59:44,140 --> 00:59:45,680
should become like
01:00:14,140 --> 01:00:15,680


Can any one please help me
# 2  
Old 10-03-2011
Looks like movie's subtitles.

Code:
gawk -v i=30  'function t(x){ split(x,a,":|,")
        str=mktime("2011 1 1 "  a[1] FS a[2] FS a[3])+i
        return strftime("%H:%M:%S",str) "," a[4]}
      /-->/ {$1=t($1);$3=t($3)}1' infile

1
00:01:48,700 --> 00:01:50,660
Hi.

2
00:01:57,040 --> 00:02:00,380
-How'd it go?
-Lousy.

3
00:02:00,460 --> 00:02:04,300
Got a '63 Thunderbird
I would've sold in a day a year ago.

4
00:02:04,330 --> 00:02:07,050
Now they just wanna look at the pictures.

5
00:02:07,470 --> 00:02:09,840
You smell nice.

6
00:02:14,140 --> 00:02:15,680
How was your day?

7
00:02:15,890 --> 00:02:17,480
It was great.

This User Gave Thanks to rdcwayx For This Post:
# 3  
Old 10-03-2011
As you said, it was a movie subtitle. And as the movie subtitle says, 'your code 'It was great.
I have a pseudo-UNIX environment for Windows.Using which i can edit the subtitles to sync it with video ......
# 4  
Old 10-03-2011
Good confirmation, in fact this code (the function part) can be used for general time difference calculation.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

infinite loop, synchronizing gossip-based method

the following code runs, but it hangs somewhere, i don't know why, #include<iostream> #include<vector> #include<cstdlib> #include<ctime> #include<list> #include<pthread.h> #include<cstring> using namespace std; pthread_mutex_t listlock = PTHREAD_MUTEX_INITIALIZER;... (3 Replies)
Discussion started by: saman_glorious
3 Replies

2. Ubuntu

Synchronizing with HTC Fuze

I have been trying to synchronise my calendar and contacts using Ubuntu and Windows Mobile on my HTC smart phone. I have read who knows how many posts, threads, blogs but still can't get this to work. I have synce installed, when I plug in my phone it recognises the phone, and lets me view... (2 Replies)
Discussion started by: naiku
2 Replies

3. UNIX for Dummies Questions & Answers

Synchronizing primary and secondary name servers

Hello All, Does some one know how to synchronize the primary name server with the secondary without knowing the domains on which synchronization failed. I have just done /usr/sbin/ndc reload Alternatively how do i find out the domains on which synchronization failed? (4 Replies)
Discussion started by: a2z1982
4 Replies

4. UNIX for Dummies Questions & Answers

Possible to track FTP user last login? Last and Finger don't track them.

Like the topic says, does anyone know if it is possible to check to see when an FTP only user has logged in? Because the shell is /bin/false and they are only using FTP to access the system doing a "finger" or "last" it says they have never logged in. Is there a way to see when ftp users log in... (1 Reply)
Discussion started by: LordJezo
1 Replies

5. Programming

synchronizing multiple threads in unix

hi all! I wanted to know how to synchronize multiple threads in unix It would be better if someone give some code samples Thanx (1 Reply)
Discussion started by: bankpro
1 Replies

6. Shell Programming and Scripting

Synchronizing files using an input file

Who wants a challenge? ;) I have a Multimedia station (Damn Small Linux) that plays Video files using MPlayer. I'm in desperate need of a Script that would be able to do the following: The Multimedia station should read, at boot or through a cron job, a "Playlist" file on a remote machine.... (1 Reply)
Discussion started by: mkoenders
1 Replies

7. UNIX for Advanced & Expert Users

Regarding Synchronizing 2 CVS.

Hi As a System Admin, I have to handle synchronzing 2 CVS. But I'm new to CVS & hardly have any knowledge of such tools. Please help me, is there any way, that can automatize the process for synchronizing the 2 remotely residing CVS database with out manual intervension. Ex:- CVA... (1 Reply)
Discussion started by: S.Vishwanath
1 Replies
Login or Register to Ask a Question