View Full Version : Help with converted timed text subtitle...
Microfiche
25th June 2025, 13:54
Hey all! I have a timed text subtitle that I pulled out of an MP4 file that I would love to fix. Mediainfo shows the format as Timed Text, Muxing mode as sbtl, and Codec ID as tx3g if that helps.
A sample portion of the SRT file I have now looks like this:
2405
01:38:18,343 --> 01:38:23,680
Simple.
I am throwing away my shots.
I am throwing my shots.
2406
01:38:23,682 --> 01:38:25,181
I am throwing away my shots.
I am throwing my shots.
Anyone and I am throwing away my
2407
01:38:25,183 --> 01:38:25,481
I am throwing my shots.
Anyone and I am throwing away my
shots.
2408
01:38:25,483 --> 01:38:33,483
Anyone and I am throwing away my
shots.
Does anyone have any ideas on how to clean this up so it is watchable?
rjd0309
25th June 2025, 15:51
How did you extract the subtitles from the MP4 file?
For timed text, I've had no problems using ffmpeg.
ffmpeg -i infile.mp4 -vn -an outfile.srt
StainlessS
25th June 2025, 16:08
I aint no expert on subs but I think those are scrolling subs, like you might get in Youtube auto generated stuff.
If used/muxed as is, then will look ok, I think.
Do they look ok in original clip ?
What is the problem you are having ?
Microfiche
25th June 2025, 16:19
How did you extract the subtitles from the MP4 file?
For timed text, I've had no problems using ffmpeg.
ffmpeg -i infile.mp4 -vn -an outfile.srt
Yes - that is how I got that SRT file
Microfiche
25th June 2025, 16:22
I aint no expert on subs but I think those are scrolling subs, like you might get in Youtube auto generated stuff.
If used/muxed as is, then will look ok, I think.
Do they look ok in original clip ?
What is the problem you are having ?
Yes - they are converted from closed captions I think and the subs look like crap, both in the original and the SRT. I hate closed captions.
StainlessS
25th June 2025, 16:22
Here is recent thread on even more weird auto generated subs.
https://forum.doom9.org/showthread.php?t=186129
EDIT:
And a YT clip which when you switch on subtitles, produces auto generated subs similar to those in above thread.
https://www.youtube.com/watch?v=EXL8mMUXs88
[Words appear one at a time, not just line at a time, and with line scrolling]
I think that you will have not much luck trying to mod to show non-scrolling subs,
I predict that hand editing to your perferences will be the only solution.
StainlessS
25th June 2025, 16:56
Hi Microfiche,
Can you post the complete srt file somewhere. [Maybe https://www.sendspace.com/ <30 days valid>]
Also, can you tell me if you are familiar with Avisynth ? [I know you are D9 newbie with only 3 posts]
I would like to play with your srt file for an hour or two, see if I can pluck out similarly timed subs and re-write without the scrolling type stuff.
I cannot guarantee anything, but I'de like to have a little try.
EDIT: I do already have script to scan srt files and add them to a database.
Would need additional script to try scan Dbase and produce separated lines as per your wish.
No idea if I can do it.
If successful, then can probably use same scripts for any future similar srt files.
Microfiche
25th June 2025, 17:40
Hi Microfiche,
Can you post the complete srt file somewhere. [Maybe https://www.sendspace.com/ <30 days valid>]
Also, can you tell me if you are familiar with Avisynth ? [I know you are D9 newbie with only 3 posts]
Nope, not familiar with Avisynth - at least not in years.
I will try that app in the link you sent earlier first and get back to you!
I need an email for Sendspace if you want to DM that. (NVM - found in your profile)
Thanks!
Microfiche
25th June 2025, 17:50
Here is recent thread on even more weird auto generated subs.
https://forum.doom9.org/showthread.php?t=186129
Yup, that dumped out the same SRT info with scrolling dupe lines.
StainlessS
25th June 2025, 18:08
I need an email for Sendspace
You can post file on sendspace without an account, however cannot eg later delete file without an account. (Links only valid for 30 days anyway)
Just keep a copy of the link given via sendspace, and post it here.
The "app in link", produces stuff like this (timed separate words, dont think of use to you)
1
00:00:00,080 --> 00:00:02,510
2
00:00:02,510 --> 00:00:02,520
remote desktop one computer remotely
3
00:00:02,520 --> 00:00:04,870
remote desktop one computer remotely
accessing<00:00:03.080><c> another</c><00:00:03.520><c> computer</c><00:00:04.200><c> we</c><00:00:04.359><c> use</c><00:00:04.520><c> it</c><00:00:04.720><c> all</c>
4
00:00:04,870 --> 00:00:04,880
accessing another computer we use it all
5
00:00:04,880 --> 00:00:06,990
accessing another computer we use it all
the<00:00:05.080><c> time</c><00:00:05.319><c> it's</c><00:00:05.520><c> required</c><00:00:06.000><c> in</c><00:00:06.200><c> it</c><00:00:06.759><c> and</c><00:00:06.879><c> you</c>
6
00:00:06,990 --> 00:00:07,000
the time it's required in it and you
7
00:00:07,000 --> 00:00:09,470
the time it's required in it and you
know<00:00:07.240><c> what</c><00:00:07.640><c> I</c><00:00:07.759><c> found</c><00:00:08.200><c> a</c><00:00:08.360><c> new</c><00:00:08.559><c> solution</c><00:00:09.160><c> that</c><00:00:09.280><c> I</c>
8
00:00:09,470 --> 00:00:09,480
know what I found a new solution that I
Microfiche
25th June 2025, 18:12
You can post file on sendspace without an account, however cannot eg later delete file without an account. (Links only valid for 30 days anyway)
Just keep a copy of the link given via sendspace, and post it here.
I just sent it to the stainlesss AT sendspace email. Thanks!
Haven't found much info on trying to fix these - the only other person out there who seems to have an issue with those types of subtitles posted here in Reddit (https://www.reddit.com/r/youtubedl/comments/xbq9un/auto_generated_captions_have_overlappingduplicate/)
StainlessS
25th June 2025, 18:24
I just sent it to the stainlesss AT sendspace email. Thanks!
Sorry, but that aint an email address, is just my shorthand for my account at SendSpace. [click on it will take you there, but, I aint used it now for quite some time and no current files on that account]
Just go here, https://www.sendspace.com/
and drag/paste your file, then dont fill in anything else, just hit UPLOAD.
Then copy the link for the "download page link", and post here in thread that link.
Microfiche
25th June 2025, 18:29
post here in thread that link.
https://www.sendspace.com/file/j69hlm
StainlessS
25th June 2025, 18:30
Got it.
Thanks, dont bother lurking around here all day, probably not post anything till tomorrow.
StainlessS
25th June 2025, 18:46
Outfile.srt, line 3413 [ the first line with RED text]
569
00:23:59,071 --> 00:23:59,670
>> NO, I'M ASKING.
WHAT IS "SATURDAY NIGHT LIVE"?
I DON'T KNOW THAT.
570
23:59,672 --> 24:03,774 # BAD Format, missing leading "00:"
WHAT IS "SATURDAY NIGHT LIVE"?
I DON'T KNOW THAT.
>> IT'S "SATURDAY NIGHT LIVE."
# ...
1404
59:57,944 --> 01:00:09,154 # BAD Format, missing leading "00:"
¶¶
>>> IT'S WEEKEND UPDATE, 50th
ANNIVERSARY EDITION.
1405
01:00:09,156 --> 01:00:19,564
>>> IT'S WEEKEND UPDATE, 50th
ANNIVERSARY EDITION.
WITH COLIN JOST AND MIKELE --
# OK from here till End
EDIT: Lots of paragraph marks from here till end
13
00:00:59,727 --> 00:01:03,062
[ LAUGHTER ]
>> I'M GLAD THEY'RE GETTING A
CHANCE TO HEAR IT TONIGHT.
14
00:01:04,697 --> 00:01:17,376
¶¶
¶ SITTING IN THE RAILWAY
STATION, TICKET FOR MY
15
00:01:17,378 --> 00:01:21,480
¶ SITTING IN THE RAILWAY
STATION, TICKET FOR MY
DESTINATION ¶
16
00:01:21,482 --> 00:01:23,148
STATION, TICKET FOR MY
DESTINATION ¶
¶ ON A TOUR OF
17
00:01:23,150 --> 00:01:24,716
DESTINATION ¶
¶ ON A TOUR OF
ONE-NIGHT STANDS
EDIT:
Looks like ASCII file has been hand edited in maybe UTF8 text editor, maybe, I think, perhaps.
Have you done any hand editing after ffmpeg conversion ???
If so, can you post unedited file.
EDIT: OK, seems that the "paragraph marks" are actually supposed to be music symbols, seems to be a song [Simon & Garfunkle, Homeward Bound].
Not really sure what to do with them. [ignore, omit, something else ???]
Emulgator
26th June 2025, 00:32
Yes, from some karaoke and other use cases:
Pilcrow -> Eighth note
¶ -> ♪
StainlessS
26th June 2025, 02:43
Thanx Emulgator, sage of the age. [I'm a poet, and don't even know it]
OK, script 1, creates DBase when WRITE_DBASE=True
1_Srt_ParseAndWriteDBase.avs # EDIT: DONT USE, See Scripts at post #28
# 1_Srt_ParseAndWriteDBase.avs # https://forum.doom9.org/showthread.php?p=2020099#post2020099
/*
Requires Avs+, RT_Stats v2.0 Beta 13 [ https://www.mediafire.com/file/xa3t1wx234gyzfq/RT_Stats_25%252626_x86_x64_dll_v2.00Beta13_20201229.zip/file ]
Will Require non weird character encoding, if necessary try UNICODE UTF8 without BOM (65001) [I did my test convert via PsPad text editor]
Allows times HOURS and MINUTES digits to be missing [With WARN to DebugView].
*/
##################
### CONFIG ######
FN =".\Outfile.srt" # Src srt file
##################
DEBUG = False # True, full debug to DebugView from M$ ( https://learn.microsoft.com/en-us/sysinternals/downloads/debugview )
# Try with False first to see WARNINGS in DebugView, then switch to True and Repeat.
WRITE_DBASE = False # If False then does Not write DBase : [FALSE for testing script parsing only]
##################
FN=RT_GetFullPathName(FN)
DB=FN+".DB"
TypeStr="s512iiii" # DBase, 5 fields, field String[512], 4 * int fields.
(WRITE_DBASE) ? RT_FileDelete(DB) : NOP # Delete any existing DBase if writing new one
(WRITE_DBASE) ? RT_DBaseAlloc(DB,0,TypeStr) : NOP # Create Empty DBase (0 records)
##################
### DBase Fields
SUBS_FLD = 0 # Subtitle text String field
SSECS_FLD = 1 # Start Seconds field
SMSECS_FLD = 2 # Start millisecs field
ESECS_FLD = 3 # End Seconds field
EMSECS_FLD = 4 # End millisecs field
###
DIGITALP="0123456789" #
TIMEALP=DIGITALP+":," #
IN = False
SubN=1 # Subtitle Number
TimeS="" # Times String
LINES=RT_FileQueryLines(FN)
For(i=0,LINES-1) {
Txt=RT_ReadTxtFromFile(FN,Lines=1,Start=i).RT_TxtGetLine.ChrEatWhite.RevStr.ChrEatWhite.RevStr # Get Line of text, remove EOL and Eat leading & trailing White Space
len=Txt.StrLen
s=Txt
if(!IN) {
if(len>0) { # Ignore Blank lines till a line ID
numlen=s.StrMatchChrLen(DIGITALP,sig=True)
Assert(numlen>0,RT_String("Line %d Subtitle Number %d NOT FOUND\n'%s'",i+1,SubN,Txt))
Number=s.RT_NumberValue
Assert(Number==SubN,RT_String("Line %d Expecting subtitle Number %d Got %d\n'%s'",i+1,SubN,Number,Txt))
s=s.MidStr(numlen+1)
Assert(s=="",RT_String("Line %d Expecting nothing after subtitle number %d, Got '%s'\n'%s'",i+1,SubN,s,Txt))
TimeS="" StartSeconds=0 StartMillisecs=0 EndSeconds=0 EndMillisecs=0
Subtitles="" SubLines=0 SubStartLine = i+1
IN = True SubIx=1 # Expecting Times next
}
} else {
if(len>0) {
if(SubIx==1) { # Times
(Len!=29 && !DEBUG) ? RT_DebugF("*** WARN : Line %d Times expecting 29 characters, got %d \n '%s'",i+1,len,Txt) : NOP
OpenTimeLen=s.StrMatchChrLen(TIMEALP,sig=True)
OpenTime = s.LeftStr(OpenTimeLen)
s=s.MidStr(OpenTimeLen+1)
OpenTime = (OpenTimeLen==9 ? "00:" : OpenTimeLen==6 ? "00:00:" : "") + OpenTime
OpenTimeLen=OpenTime.Strlen
Assert(OpenTimeLen==12,RT_String("Line %d Open Times expecting 12 characters, got %d \n'%s'",i+1,OpenTimeLen,OpenTime))
StartSeconds=(OpenTime.MidStr(1,2).RT_NumberValue*60+OpenTime.MidStr(4,2).RT_NumberValue)*60+OpenTime.MidStr(7,2).RT_NumberValue
StartMillisecs=OpenTime.MidStr(10,3).RT_NumberValue
Assert(s.LeftStr(5)==" --> ",RT_String("Line %d expecting ' --> '\n'%s'",i+1,s))
s=s.MidStr(6)
EndTimeLen=s.StrMatchChrLen(TIMEALP,sig=True)
EndTime = s.LeftStr(EndTimeLen)
s=s.MidStr(EndTimeLen+1)
EndTime = (EndTimeLen==9 ? "00:" : EndTimeLen==6 ? "00:00:" : "") + EndTime
EndTimeLen=EndTime.Strlen
Assert(EndTimeLen==12,RT_String("Line %d End Times expecting 12 characters, got %d \n'%s'",i+1,EndTimeLen,EndTime))
EndSeconds=(EndTime.MidStr(1,2).RT_NumberValue*60+EndTime.MidStr(4,2).RT_NumberValue)*60+EndTime.MidStr(7,2).RT_NumberValue
EndMillisecs=EndTime.MidStr(10,3).RT_NumberValue
Times = OpenTime + " --> " + EndTime
SubIx=2
} else if(SubIx==2) { # Text
Subtitles=(SubLines==0)?Txt:Subtitles+Chr(10)+Txt
SubLines=SubLines+1
} Else {
Assert(false,"Bad SubIx")
}
}
if(len==0 || i+1>=LINES) {
Assert(SubIx==2,RT_String("Line %d Expecting %s\n'%s'",i+1,SubIx==0?"Subtitle Number":"Times",Txt))
If(WRITE_DBASE) {
RT_DBaseAppend(DB,Subtitles,StartSeconds,StartMillisecs,EndSeconds,EndMillisecs)
}
(DEBUG) ? RT_DebugF("####### LINE %d #######\n%d\n%s\n%s\n",SubStartLine,SubN,Times,Subtitles) : NOP
SubN=SubN+1
IN = False
}
}
}
Return (!WRITE_DBASE)
\ ? MessageClip(RT_String("Parse Only\n'%s'",FN))
\ : MessageClip(RT_String("Parse And Write DBAse\n'%s'\n'%s'",FN,DB))
##############################
Function ChrEatWhite(String S) {i=1 C=RT_Ord(S,i) While(C==32||C>=8&&C<=13) {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
# Return extent of string S [ie length from the beginning] that matches any character in Chars set of characters [Default case insignificant]. # StrMatchChrLen("1234.567abcd","0123456789.") = 8
Function StrMatchChrLen(String s,String Chars,Bool "Sig") {
Function __StrMatchChrLen_LOW(String s,String Chars,int n) { c=s.MidStr(n+1,1) Return(c==""||Chars.FindStr(c)==0) ? n : s.__StrMatchChrLen_LOW(Chars,n+1) }
Sig=Default(Sig,False) # Default Case Insignificant
s=(Sig)?s:s.UCASE Chars=(Sig)?Chars:Chars.UCASE
__StrMatchChrLen_LOW(s,Chars,0)
}
Sample from Debugview when DEBUG=FALSE [ Allows times HOURS/MINUTES digits to be missing [With WARN to DebugView]. ]
00000100 02:27:14 [7736] RT_DebugF: *** WARN : Line 3413 Times expecting 29 characters, got 23
00000101 02:27:14 [7736] RT_DebugF: '23:59,672 --> 24:03,774' # EDIT: Hours '00:' missing for both start/end times.
00000102 02:27:14 [7736] RT_DebugF: *** WARN : Line 3419 Times expecting 29 characters, got 23
00000103 02:27:14 [7736] RT_DebugF: '24:03,776 --> 24:04,475'
00000104 02:27:14 [7736] RT_DebugF: *** WARN : Line 3425 Times expecting 29 characters, got 23
00000105 02:27:14 [7736] RT_DebugF: '24:04,477 --> 24:07,278'
00000106 02:27:14 [7736] RT_DebugF: *** WARN : Line 3431 Times expecting 29 characters, got 23
# ...
00001762 02:27:18 [7736] RT_DebugF: *** WARN : Line 8382 Times expecting 29 characters, got 23
00001763 02:27:18 [7736] RT_DebugF: '59:24,511 --> 59:31,350'
00001764 02:27:18 [7736] RT_DebugF: *** WARN : Line 8388 Times expecting 29 characters, got 23
00001765 02:27:18 [7736] RT_DebugF: '59:31,352 --> 59:38,824'
00001766 02:27:18 [7736] RT_DebugF: *** WARN : Line 8394 Times expecting 29 characters, got 23
00001767 02:27:18 [7736] RT_DebugF: '59:49,669 --> 59:52,871'
00001768 02:27:18 [7736] RT_DebugF: *** WARN : Line 8398 Times expecting 29 characters, got 26
00001769 02:27:18 [7736] RT_DebugF: '59:57,944 --> 01:00:09,154' # EDIT: Hours '00:' missing for start time only.
Sample from Debugview when DEBUG=TRUE [Missing HOURS/MINUTES digits silently fixed, Set WRITE_DBASE=true to also write DB]
00001869 02:27:50 [11988] RT_DebugF: ####### LINE 1 #######
00001870 02:27:50 [11988] RT_DebugF: 1
00001871 02:27:50 [11988] RT_DebugF: 00:00:05,472 --> 00:00:13,445
00001872 02:27:50 [11988] RT_DebugF: [ CHEERS AND APPLAUSE ]
00001873 02:27:50 [11988] RT_DebugF:
00001874 02:27:50 [11988] RT_DebugF: ####### LINE 5 #######
00001875 02:27:50 [11988] RT_DebugF: 2
00001876 02:27:50 [11988] RT_DebugF: 00:00:25,158 --> 00:00:30,863
00001877 02:27:50 [11988] RT_DebugF: >>> LADIES AND GENTLEMEN, THIS
00001878 02:27:50 [11988] RT_DebugF: IS SABRINA CARPENTER.
00001879 02:27:50 [11988] RT_DebugF: [ CHEERING ]
00001880 02:27:50 [11988] RT_DebugF:
00001881 02:27:50 [11988] RT_DebugF: ####### LINE 11 #######
00001882 02:27:50 [11988] RT_DebugF: 3
00001883 02:27:50 [11988] RT_DebugF: 00:00:30,865 --> 00:00:31,630
00001884 02:27:50 [11988] RT_DebugF: IS SABRINA CARPENTER.
00001885 02:27:50 [11988] RT_DebugF: [ CHEERING ]
00001886 02:27:50 [11988] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00001887 02:27:50 [11988] RT_DebugF:
00001888 02:27:50 [11988] RT_DebugF: ####### LINE 17 #######
00001889 02:27:50 [11988] RT_DebugF: 4
00001890 02:27:50 [11988] RT_DebugF: 00:00:31,632 --> 00:00:31,930
00001891 02:27:50 [11988] RT_DebugF: [ CHEERING ]
00001892 02:27:50 [11988] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00001893 02:27:50 [11988] RT_DebugF: SIMON.
00001894 02:27:50 [11988] RT_DebugF:
00001895 02:27:50 [11988] RT_DebugF: ####### LINE 23 #######
00001896 02:27:50 [11988] RT_DebugF: 5
00001897 02:27:50 [11988] RT_DebugF: 00:00:31,932 --> 00:00:37,236
00001898 02:27:50 [11988] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00001899 02:27:50 [11988] RT_DebugF: SIMON.
00001900 02:27:50 [11988] RT_DebugF: [ CHEERING ]
00001901 02:27:50 [11988] RT_DebugF:
00001902 02:27:50 [11988] RT_DebugF: ####### LINE 29 #######
00001903 02:27:50 [11988] RT_DebugF: 6
00001904 02:27:50 [11988] RT_DebugF: 00:00:37,238 --> 00:00:41,140
00001905 02:27:50 [11988] RT_DebugF: SIMON.
00001906 02:27:50 [11988] RT_DebugF: [ CHEERING ]
00001907 02:27:50 [11988] RT_DebugF: >> I SANG THIS SONG WITH GEORGE
00001908 02:27:50 [11988] RT_DebugF:
StainlessS
26th June 2025, 03:01
Script 2, Show already written DBase # EDIT: DONT USE, See Scripts at post #28
2_SrtShowDB.avs # https://forum.doom9.org/showthread.php?p=2020100#post2020100
# 2_SrtShowDB.avs
# Show Subs DBase via DebugView, times are in seconds only
DB = "./Outfile.srt.DB"
DB = RT_GetFullPathName(DB)
### DBase Fields
# TypeStr="s512iiii" # DBase 5 fields, field String[512], 4 * int fields.
SUBS_FLD = 0 # Subtitle text String field
SSECS_FLD = 1 # Start Seconds field
SMSECS_FLD = 2 # Start millisecs field
ESECS_FLD = 3 # End Seconds field
EMSECS_FLD = 4 # End millisecs field
Records = RT_DBaseRecords(DB)
PadS=" "
for(i=0,Records-1) {
SUBS = RT_DBaseGetField(DB,i,SUBS_FLD)
STime = RT_DBaseGetField(DB,i,SSECS_FLD).String() + "." + RT_DBaseGetField(DB,i,SMSECS_FLD).String()
ETime = RT_DBaseGetField(DB,i,ESECS_FLD).String() + "." + RT_DBaseGetField(DB,i,EMSECS_FLD).String()
S=RT_StrReplace(SUBS,Chr(10),Chr(10)+PadS) # Format spacing for DebugView writing
RT_DebugF("%d\n%s%s\n%s%s\n%s%s",i+1,PadS,STime,PadS,ETime,PadS,S)
}
return MessageClip("Done")
From Debugview
00000100 02:30:33 [13372] RT_DebugF: 1
00000101 02:30:33 [13372] RT_DebugF: 5.472 # EDIT: Start Time in seconds
00000102 02:30:33 [13372] RT_DebugF: 13.445 # EDIT: End Time in seconds
00000103 02:30:33 [13372] RT_DebugF: [ CHEERS AND APPLAUSE ]
00000104 02:30:33 [13372] RT_DebugF: 2
00000105 02:30:33 [13372] RT_DebugF: 25.158
00000106 02:30:33 [13372] RT_DebugF: 30.863
00000107 02:30:33 [13372] RT_DebugF: >>> LADIES AND GENTLEMEN, THIS
00000108 02:30:33 [13372] RT_DebugF: IS SABRINA CARPENTER.
00000109 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000110 02:30:33 [13372] RT_DebugF: 3
00000111 02:30:33 [13372] RT_DebugF: 30.865
00000112 02:30:33 [13372] RT_DebugF: 31.630
00000113 02:30:33 [13372] RT_DebugF: IS SABRINA CARPENTER.
00000114 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000115 02:30:33 [13372] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00000116 02:30:33 [13372] RT_DebugF: 4
00000117 02:30:33 [13372] RT_DebugF: 31.632
00000118 02:30:33 [13372] RT_DebugF: 31.930
00000119 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000120 02:30:33 [13372] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00000121 02:30:33 [13372] RT_DebugF: SIMON.
00000122 02:30:33 [13372] RT_DebugF: 5
00000123 02:30:33 [13372] RT_DebugF: 31.932
00000124 02:30:33 [13372] RT_DebugF: 37.236
00000125 02:30:33 [13372] RT_DebugF: >> THIS IS THE ONE AND ONLY PAUL
00000126 02:30:33 [13372] RT_DebugF: SIMON.
00000127 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000128 02:30:33 [13372] RT_DebugF: 6
00000129 02:30:33 [13372] RT_DebugF: 37.238
00000130 02:30:33 [13372] RT_DebugF: 41.140
00000131 02:30:33 [13372] RT_DebugF: SIMON.
00000132 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000133 02:30:33 [13372] RT_DebugF: >> I SANG THIS SONG WITH GEORGE
00000134 02:30:33 [13372] RT_DebugF: 7
00000135 02:30:33 [13372] RT_DebugF: 41.142
00000136 02:30:33 [13372] RT_DebugF: 42.941
00000137 02:30:33 [13372] RT_DebugF: [ CHEERING ]
00000138 02:30:33 [13372] RT_DebugF: >> I SANG THIS SONG WITH GEORGE
00000139 02:30:33 [13372] RT_DebugF: HARRISON ON "SATURDAY NIGHT
00000140 02:30:33 [13372] RT_DebugF: 8
00000141 02:30:33 [13372] RT_DebugF: 42.943
00000142 02:30:33 [13372] RT_DebugF: 45.511
00000143 02:30:33 [13372] RT_DebugF: >> I SANG THIS SONG WITH GEORGE
00000144 02:30:33 [13372] RT_DebugF: HARRISON ON "SATURDAY NIGHT
00000145 02:30:33 [13372] RT_DebugF: LIVE" IN 1976.
00000146 02:30:33 [13372] RT_DebugF: 9
00000147 02:30:33 [13372] RT_DebugF: 45.513
00000148 02:30:33 [13372] RT_DebugF: 47.980
00000149 02:30:33 [13372] RT_DebugF: HARRISON ON "SATURDAY NIGHT
00000150 02:30:33 [13372] RT_DebugF: LIVE" IN 1976.
00000151 02:30:33 [13372] RT_DebugF: >> I WAS NOT BORN THEN, AND
00000152 02:30:33 [13372] RT_DebugF: 10
00000153 02:30:33 [13372] RT_DebugF: 47.982
00000154 02:30:33 [13372] RT_DebugF: 48.580
00000155 02:30:33 [13372] RT_DebugF: LIVE" IN 1976.
00000156 02:30:33 [13372] RT_DebugF: >> I WAS NOT BORN THEN, AND
00000157 02:30:33 [13372] RT_DebugF: NEITHER WERE MY PARENTS.
# ...
00021944 03:25:31 [9220] RT_DebugF: 3653
00021945 03:25:31 [9220] RT_DebugF: 9003.612
00021946 03:25:31 [9220] RT_DebugF: 9006.279
00021947 03:25:31 [9220] RT_DebugF: ALL HERE, THE MAN WHO MADE OUR
00021948 03:25:31 [9220] RT_DebugF: DREAM COME TRUE, THE ONE AND
00021949 03:25:31 [9220] RT_DebugF: ONLY, OH, AND PAUL.
00021950 03:25:31 [9220] RT_DebugF: 3654
00021951 03:25:31 [9220] RT_DebugF: 9006.281
00021952 03:25:31 [9220] RT_DebugF: 9007.80
00021953 03:25:31 [9220] RT_DebugF: DREAM COME TRUE, THE ONE AND
00021954 03:25:31 [9220] RT_DebugF: ONLY, OH, AND PAUL.
00021955 03:25:31 [9220] RT_DebugF: LORNE MICHAELS!
00021956 03:25:31 [9220] RT_DebugF: 3655
00021957 03:25:31 [9220] RT_DebugF: 9007.82
00021958 03:25:31 [9220] RT_DebugF: 9020.560
00021959 03:25:31 [9220] RT_DebugF: ONLY, OH, AND PAUL.
00021960 03:25:31 [9220] RT_DebugF: LORNE MICHAELS!
00021961 03:25:31 [9220] RT_DebugF: [ CHEERS AND APPLAUSE ]
00021962 03:25:31 [9220] RT_DebugF: 3656
00021963 03:25:31 [9220] RT_DebugF: 9020.562
00021964 03:25:31 [9220] RT_DebugF: 9024.130
00021965 03:25:31 [9220] RT_DebugF: LORNE MICHAELS!
00021966 03:25:31 [9220] RT_DebugF: [ CHEERS AND APPLAUSE ]
00021967 03:25:31 [9220] RT_DebugF: 50, BEST OF LUCK, WE CAN'T WAIT.
00021968 03:25:31 [9220] RT_DebugF: 3657
00021969 03:25:31 [9220] RT_DebugF: 9024.132
00021970 03:25:31 [9220] RT_DebugF: 9026.132
00021971 03:25:31 [9220] RT_DebugF: [ CHEERS AND APPLAUSE ]
00021972 03:25:31 [9220] RT_DebugF: 50, BEST OF LUCK, WE CAN'T WAIT.
00021973 03:25:31 [9220] RT_DebugF: GOD KNOWS WE LOVE YOU ALL.
00021974 03:25:31 [9220] RT_DebugF: 3658
00021975 03:25:31 [9220] RT_DebugF: 9026.134
00021976 03:25:31 [9220] RT_DebugF: 9026.866
00021977 03:25:31 [9220] RT_DebugF: 50, BEST OF LUCK, WE CAN'T WAIT.
00021978 03:25:31 [9220] RT_DebugF: GOD KNOWS WE LOVE YOU ALL.
00021979 03:25:31 [9220] RT_DebugF: GOOD NIGHT AND GOD BLESS!
00021980 03:25:31 [9220] RT_DebugF: 3659
00021981 03:25:31 [9220] RT_DebugF: 9026.868
00021982 03:25:31 [9220] RT_DebugF: 9030.436
00021983 03:25:31 [9220] RT_DebugF: GOD KNOWS WE LOVE YOU ALL.
00021984 03:25:31 [9220] RT_DebugF: GOOD NIGHT AND GOD BLESS!
00021985 03:25:31 [9220] RT_DebugF: [ CHEERS AND APPLAUSE ]
00021986 03:25:31 [9220] RT_DebugF: 3660
00021987 03:25:31 [9220] RT_DebugF: 9031.972
00021988 03:25:31 [9220] RT_DebugF: 9040.847
00021989 03:25:31 [9220] RT_DebugF: ¶¶
00021990 03:25:31 [9220] RT_DebugF: [ APPLAUSE ]
00021991 03:25:31 [9220] RT_DebugF: 3661
00021992 03:25:31 [9220] RT_DebugF: 9042.449
00021993 03:25:31 [9220] RT_DebugF: 9051.858
00021994 03:25:31 [9220] RT_DebugF: ¶¶
00021995 03:25:31 [9220] RT_DebugF: 3662
00021996 03:25:31 [9220] RT_DebugF: 9054.795
00021997 03:25:31 [9220] RT_DebugF: 9061.534
00021998 03:25:31 [9220] RT_DebugF: ¶¶
00021999 03:25:31 [9220] RT_DebugF: 3663
00022000 03:25:31 [9220] RT_DebugF: 9069.543
00022001 03:25:31 [9220] RT_DebugF: 9076.749
00022002 03:25:31 [9220] RT_DebugF: ¶¶
00022003 03:25:31 [9220] RT_DebugF: 3664
00022004 03:25:31 [9220] RT_DebugF: 9091.966
00022005 03:25:31 [9220] RT_DebugF: 9099.105
00022006 03:25:31 [9220] RT_DebugF: ¶¶
00022007 03:25:31 [9220] RT_DebugF: 3665
00022008 03:25:31 [9220] RT_DebugF: 9101.41
00022009 03:25:31 [9220] RT_DebugF: 9106.913
00022010 03:25:31 [9220] RT_DebugF: ¶¶
00022011 03:25:31 [9220] RT_DebugF: 3666
00022012 03:25:31 [9220] RT_DebugF: 9116.957
00022013 03:25:31 [9220] RT_DebugF: 9125.398
00022014 03:25:31 [9220] RT_DebugF: ¶¶
00022015 03:25:31 [9220] RT_DebugF: 3667
00022016 03:25:31 [9220] RT_DebugF: 9127.234
00022017 03:25:31 [9220] RT_DebugF: 9134.374
00022018 03:25:31 [9220] RT_DebugF: ¶¶
00022019 03:25:31 [9220] RT_DebugF: 3668
00022020 03:25:31 [9220] RT_DebugF: 9136.443
00022021 03:25:31 [9220] RT_DebugF: 9137.109
00022022 03:25:31 [9220] RT_DebugF: ¶
Need remaining script will be to try separate the text somehow, not really sure how to do that yet.
StainlessS
27th June 2025, 15:33
Tool to aid me in writing fix script, + compare original with fixed srt.
SrtRenderCompareSubs.avs # EDIT: DONT USE, See Scripts at post #28
# SrtRenderCompareSubs.avs # https://forum.doom9.org/showthread.php?p=2020155#post2020155
#
# Requires TextSub() from VsFilter.dll # https://github.com/pinterf/xy-VSFilter/releases
#
SRT1 = ".\Outfile.srt" # Original srt
SRT2 = "" # Comparison srt (compare original with fixed), "" = Just show original.
#SRT2 = SRT1
FPS = 25.0 # Original FrameRate
#####################
DB = Srt1 + ".DB"
SRT1 = RT_GetFullPathName(SRT1)
SRT2 = (SRT2!="") ? RT_GetFullPathName(SRT2) : SRT2
#####################
### DBase Fields
# TypeStr="s512iiii" # DBase, 5 fields, field String[512], 4 * int fields.
SUBS_FLD = 0 # Subtitle text String field
SSECS_FLD = 1 # Start Seconds field
SMSECS_FLD = 2 # Start millisecs field
ESECS_FLD = 3 # End Seconds field
EMSECS_FLD = 4 # End millisecs field
#####################
DB = RT_GetFullPathName(DB)
Records = Exist(DB) ? RT_DBaseRecords(DB) : 0
Seconds = (Records<=0 ? 03*3600 : RT_DBaseGetField(DB,Records-1,ESECS_FLD)) + 30
Frames = (Seconds * FPS).Round
Last = BlankClip(Width=1280,Height=720,Length=Frames,Pixel_Type="YV12",fps=FPS)
(SRT2=="") ? TextSub(SRT1) : StackHorizontal(TextSub(SRT1),TextSub(SRT2))
ShowTime()
Return Last
pc_speak
28th June 2025, 02:04
This is my default method. Works for 95% of my ttx subtitles.
@echo off
for %%a in (*.mp4) do call :process1 "%%a"
goto :end
:process1
"C:\CCExtractor 0.94\ccextractorwinfull.exe" -codec teletext %1 -o "%~dpn1.srt"
goto :eof
:end
pauseCCExtractor has several parameters you can try.
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -o "my video.srt"
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -dru -o "my video-direct_rollup.srt"
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -noru -o "my video-norollup.srt"
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -ru1 -o "my video-ru1.srt"
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -ru2 -o "my video-ru2.srt"
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -ru3 -o "my video-ru3.srt"One of them may work.
I tend to load them all into the one batch file. Run it, and then take a peek at all the srt files.
StainlessS
28th June 2025, 10:15
"C:\CCExtractor 0.94\ccextractorwinfull.exe" "my video.mp4" -noru -o "my video-norollup.srt"
That one looks promising. [I cant test it, looks like it requires an mp4 file with muxed subs, I only got *.srt]
Microfiche, Post how you get on with it.
I'll still mess with my solution for a while longer, I'll post whatever I come up with (eventually).
Microfiche
3rd July 2025, 14:25
Thanks all! For some reason I stopped getting notifications from the forum so I thought this thread died.
FYI - the srt provided was not edited (as I think you determined)
I will see what I can do with CCextractor!
Microfiche
3rd July 2025, 14:43
I tried all the ccextractor command line options - no go.
They all put out pretty much the same format as I have already.
I give up!
Thanks for all your help @StainlessS and @pc_speak
Much appreciated. :thanks:
StainlessS
5th July 2025, 01:20
Sorry Microfiche, There's been a bit of a heatwave in the UK and been in the pub quite a lot.
I thought that ccextractor would have sorted you out, alas not.
I'll try to get back to the script in the not too distant future, I think that can provide a solution but dont hold your breath.
Microfiche
5th July 2025, 15:40
Sorry Microfiche, There's been a bit of a heatwave in the UK and been in the pub quite a lot.
I thought that ccextractor would have sorted you out, alas not.
I'll try to get back to the script in the not too distant future, I think that can provide a solution but dont hold your breath.
No worries! I have received a couple of other versions I am going to try out. I have only had subtitles (from CC I think) a couple of times and have never found a way to use them, for some reason I find the timing irritating.
Appreciate the time you have put in - escape the heat!
We had 37° C here a few days ago, but it is really low humidity here, so that is bearable.
pc_speak
5th July 2025, 20:07
I created subs using whisper. They are here. https://www.sendspace.com/file/paxkr8
StainlessS
6th July 2025, 19:42
Hi MicroFiche, [EDIT: we had up to 34c here, not quite so bearable humidity]
https://www.mediafire.com/file/ctpxbpkuk7h9o9h/MicroFiche.7z/file
# EDIT: DONT USE above zip scripts, See Scripts at post #28
Above [~18KB] contains original extracted subs (outfile.srt) and my Result.srt with scrolling subs eradicated.
I have not spent that much time checking them all, but looks good to me.
I'm gonna have a nap now and as I only just got what I think is pretty much my best expected result,
thought you might like to take a gander.
I'll still spend some time cleaning up the script before I do post it (maybe tomorrow).
Also contains avisynth comparison script to show input and output subs.
Requires Avisynth and TextSub() from VsFilter.dll # https://github.com/pinterf/xy-VSFilter/releases
EDIT: Suggest loading script into VirtualDub2 for perusal.
EDIT:
About 24 mins in, the original outfile.srt has the missing "00:" leading hours timings missing for a time,
and in the comparison script, those subs dont show up. [only the result.srt subs show, as we fix the missing '00:']
as described here
Outfile.srt, line 3413 [ the first line with RED text]
569
00:23:59,071 --> 00:23:59,670
>> NO, I'M ASKING.
WHAT IS "SATURDAY NIGHT LIVE"?
I DON'T KNOW THAT.
570
23:59,672 --> 24:03,774 # BAD Format, missing leading "00:"
WHAT IS "SATURDAY NIGHT LIVE"?
I DON'T KNOW THAT.
>> IT'S "SATURDAY NIGHT LIVE."
# ...
1404
59:57,944 --> 01:00:09,154 # BAD Format, missing leading "00:"
¶¶
>>> IT'S WEEKEND UPDATE, 50th
ANNIVERSARY EDITION.
1405
01:00:09,156 --> 01:00:19,564
>>> IT'S WEEKEND UPDATE, 50th
ANNIVERSARY EDITION.
WITH COLIN JOST AND MIKELE --
# OK from here till End
EDIT: To fix the original Outfile.srt, load it into SubtitleEdit, and do a renumber from the edit menu (I think),
then save, that fixes the times missing '00:' and will then work ok in the comparison script.
EDIT: Posted SubtitleEdit bug report about Outfile.srt here:- https://forum.doom9.org/showthread.php?p=2020458#post2020458
StainlessS
7th July 2025, 07:14
Post #1 of 4.
Here, Final version unscroller thingy.
https://www.mediafire.com/file/e10yi20qm9s1qyd/MicroFiche_Unscroller(v2).7z/file
Creates both a DBase and FIXED.srt when using "1_Srt_ParseAndWriteDBase.avs",
Fixed srt has missing times hours digits fixed and subtitles ID number renumberd,
and it is the Fixed.srt file that is used by other scripts.
All working perfectly well (although some subs may be on screen only for a short period,
I'm assuming something like SubtitleEdit can fix those).
1_Srt_ParseAndWriteDBase.avs
# 1_Srt_ParseAndWriteDBase.avs # https://forum.doom9.org/showthread.php?p=2020462#post2020462
/*
Requires Avs+, RT_Stats v2.0 Beta 13 [ https://www.mediafire.com/file/xa3t1wx234gyzfq/RT_Stats_25%252626_x86_x64_dll_v2.00Beta13_20201229.zip/file ]
Also need DebugView from M$ ( https://learn.microsoft.com/en-us/sysinternals/downloads/debugview )
Creates re-written srt file as FIXED.srt, and DBase as FIXED.srt.DB
FIXES to output FIXED.srt
Multiple blank lines subs separator fixed with single blank line.
Subtitle ID number, missing or out of sequence fixed.
Start/End times HOURS and MINUTES digits missing
[Fixes with WARN to DebugView when DEBUG==FALSE].
*/
############################################
### CONFIG ######
FN = ".\Source.srt" # Src srt file (input)
###
DEBUG = False # Try with False first to see input srt fixes WARNINGS.
# True, DB creating Debug but excluding srt fixes warnings.
WRITE_DBASE = True # If False then does Not write DBase : [FALSE for testing script parsing only]
# DebugView from M$ ( https://learn.microsoft.com/en-us/sysinternals/downloads/debugview )
###
FIXED_FN = ".\FIXED.srt" # (DONT CHANGE) Output Srt file with any fixed subtitle index and or fixed times. (DB made for this srt file)
############################################
############################################
############################################
### DBase Fields
TypeStr="iiiis512" # DBase, 5 fields, 4 * int fields, 1 * field String[512].
SSECS_FLD = 0 # Start Seconds field
SMSECS_FLD = 1 # Start millisecs field
ESECS_FLD = 2 # End Seconds field
EMSECS_FLD = 3 # End millisecs field
SUBS_FLD = 4 # Subtitle text String field
###
FN=RT_GetFullPathName(FN)
FIXED_FN=RT_GetFullPathName(FIXED_FN)
DB=FIXED_FN+".DB"
RT_FileDelete(FIXED_FN)
(WRITE_DBASE) ? RT_FileDelete(DB) : NOP # Delete any existing DBase if writing new one
(WRITE_DBASE) ? RT_DBaseAlloc(DB,0,TypeStr) : NOP # Create Empty DBase (0 records)
##################
DIGITALP="0123456789" # Digits alphabet
TIMEALP=DIGITALP+":," # Time alphabet
IN = False
SubN=1 # Subtitle Number
TimeS="" # Times String
LINES=RT_FileQueryLines(FN)
For(i=0,LINES-1) {
Txt=RT_ReadTxtFromFile(FN,Lines=1,Start=i).RT_TxtGetLine.ChrEatWhite.RevStr.ChrEatWhite.RevStr # Get Line of text, remove EOL and Eat leading & trailing White Space
Txt=Txt.RT_StrReplace("<b\>",Chr(10)) # Soft line breaks to real linebreaks.
len=Txt.StrLen
s=Txt
if(!IN) {
if(len>0) { # Ignore Blank lines till a line ID
# This line expecting Subs ID number
IN = True SubIx=1 # Expecting Times next loop line
TimeS="" StartSeconds=0 StartMillisecs=0 EndSeconds=0 EndMillisecs=0
Subtitles="" SubLines=0 SubStartLine = i+1
numlen=s.StrMatchChrLen(DIGITALP,sig=True)
if(numlen<=0) {
Number=SubN
(!DEBUG) ? RT_DebugF("*** WARN : Line %d Subtitle Number %d NOT FOUND\n'%s'",i+1,SubN,Txt) : NOP
i = i-1 # Next loop, retry same text line but look for subtitle start/end times.
Continue # Retry same line in For() loop with SubIx=1 (Start/End times)
}
Number=s.RT_NumberValue
if(Number!=SubN && !DEBUG) { RT_DebugF("Line %d Expecting subtitle Number %d Got %d",i+1,SubN,Number) }
s=s.MidStr(numlen+1)
if(s!="" && !DEBUG) { RT_DebugF("Line %d Expecting nothing after subtitle number %d, Got '%s'\n'%s'",i+1,SubN,s,Txt) }
}
} else {
if(len>0) {
if(SubIx==1) { # Times
(Len!=29 && !DEBUG) ? RT_DebugF("*** WARN : Line %d Times expecting 29 characters, got %d \n '%s'",i+1,len,Txt) : NOP
OpenTimeLen=s.StrMatchChrLen(TIMEALP,sig=True)
OpenTime = s.LeftStr(OpenTimeLen)
s=s.MidStr(OpenTimeLen+1)
OpenTime = (OpenTimeLen==9 ? "00:" : OpenTimeLen==6 ? "00:00:" : "") + OpenTime
OpenTimeLen=OpenTime.Strlen
Assert(OpenTimeLen==12,RT_String("Line %d Open Times expecting 12 characters, got %d \n'%s'",i+1,OpenTimeLen,OpenTime))
StartSeconds=(OpenTime.MidStr(1,2).RT_NumberValue*60+OpenTime.MidStr(4,2).RT_NumberValue)*60+OpenTime.MidStr(7,2).RT_NumberValue
StartMillisecs=OpenTime.MidStr(10,3).RT_NumberValue
Assert(s.LeftStr(5)==" --> ",RT_String("Line %d expecting ' --> '\n'%s'",i+1,s))
s=s.MidStr(6)
EndTimeLen=s.StrMatchChrLen(TIMEALP,sig=True)
EndTime = s.LeftStr(EndTimeLen)
s=s.MidStr(EndTimeLen+1)
EndTime = (EndTimeLen==9 ? "00:" : EndTimeLen==6 ? "00:00:" : "") + EndTime
EndTimeLen=EndTime.Strlen
Assert(EndTimeLen==12,RT_String("Line %d End Times expecting 12 characters, got %d \n'%s'",i+1,EndTimeLen,EndTime))
EndSeconds=(EndTime.MidStr(1,2).RT_NumberValue*60+EndTime.MidStr(4,2).RT_NumberValue)*60+EndTime.MidStr(7,2).RT_NumberValue
EndMillisecs=EndTime.MidStr(10,3).RT_NumberValue
Times = OpenTime + " --> " + EndTime
SubIx=2
} else if(SubIx==2) { # Text
Subtitles=(SubLines==0)?Txt:Subtitles+Chr(10)+Txt
SubLines=SubLines+1
} Else {
Assert(false,"Bad SubIx")
}
}
if(len==0 || i+1>=LINES) {
Assert(SubIx==2,RT_String("Line %d Expecting %s\n'%s'",i+1,SubIx==0?"Subtitle Number":"Times",Txt))
If(WRITE_DBASE) {
RT_DBaseAppend(DB,StartSeconds,StartMillisecs,EndSeconds,EndMillisecs,Subtitles)
}
RT_WriteFile(FIXED_FN,"%d\n%s\n%s\n\n",SubN,Times,Subtitles,Append=true)
(DEBUG) ? RT_DebugF("####### LINE %d #######\n%d\n%s\n%s\n",SubStartLine,SubN,Times,Subtitles) : NOP
SubN=SubN+1
IN = False
}
}
}
Return (!WRITE_DBASE)
\ ? MessageClip(RT_String("Parse Only\nOutput '%s'",FIXED_FN))
\ : MessageClip(RT_String("Parse And Write DBAse\nOutput '%s'\n'%s'",FIXED_FN,DB))
##############################
Function ChrEatWhite(String S) {i=1 C=RT_Ord(S,i) While(C==32||C>=8&&C<=13) {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
# Return extent of string S [ie length from the beginning] that matches any character in Chars set of characters [Default case insignificant]. # StrMatchChrLen("1234.567abcd","0123456789.") = 8
Function StrMatchChrLen(String s,String Chars,Bool "Sig") {
Function __StrMatchChrLen_LOW(String s,String Chars,int n) { c=s.MidStr(n+1,1) Return(c==""||Chars.FindStr(c)==0) ? n : s.__StrMatchChrLen_LOW(Chars,n+1) }
Sig=Default(Sig,False) # Default Case Insignificant
s=(Sig)?s:s.UCASE Chars=(Sig)?Chars:Chars.UCASE
__StrMatchChrLen_LOW(s,Chars,0)
}
StainlessS
7th July 2025, 07:15
Post #2 of 2
2_SrtShowDB.avs
# 2_SrtShowDB.avs
# Show Subs DBase via DebugView, times are in seconds only
DB = "./FIXED.srt.DB"
DB = RT_GetFullPathName(DB)
### DBase Fields
# TypeStr="iiiis512" # DBase 5 fields, 4 * int fields, String[512] field.
SSECS_FLD = 0 # Start Seconds field
SMSECS_FLD = 1 # Start millisecs field
ESECS_FLD = 2 # End Seconds field
EMSECS_FLD = 3 # End millisecs field
SUBS_FLD = 4 # Subtitle text String field
Records = RT_DBaseRecords(DB)
PadS=" "
for(i=0,Records-1) {
STime = RT_DBaseGetField(DB,i,SSECS_FLD).String() + "." + RT_DBaseGetField(DB,i,SMSECS_FLD).String()
ETime = RT_DBaseGetField(DB,i,ESECS_FLD).String() + "." + RT_DBaseGetField(DB,i,EMSECS_FLD).String()
SUBS = RT_DBaseGetField(DB,i,SUBS_FLD)
S=RT_StrReplace(SUBS,Chr(10),Chr(10)+PadS) # Format spacing for DebugView writing
RT_DebugF("%d\n%s%s\n%s%s\n%s%s",i+1,PadS,STime,PadS,ETime,PadS,S)
}
return MessageClip("Done")
StainlessS
7th July 2025, 07:16
Post #3 of 3.
3_SrtUnScrollWrite.avs
# 3_SrtUnScrollWrite.avs
##################
DB = ".\Fixed.srt.DB" # Created by 1_ParseAndWriteDBase.avs
SRT = ".\Result.srt" # Output non-scrolling Srt file
GAP_MS = 10 # 10 Millisecs or less gaps between scrolling subs, else is new start of separate sub.
COMMA = True # Srt usually requires ',' COMMA as Millisecs separator
DEBUG = False # Output debug to DebugView
##################
DB = RT_GetFullPathName(DB)
SRT = RT_GetFullPathName(SRT)
### DBase Fields
# TypeStr="iiiis512" # DBase 5 fields, 4 * int fields, String[512] field.
SSECS_FLD = 0 # Start Seconds field
SMSECS_FLD = 1 # Start millisecs field
ESECS_FLD = 2 # End Seconds field
EMSECS_FLD = 3 # End millisecs field
SUBS_FLD = 4 # Subtitle text String field
######
RT_FileDelete(SRT) # Prep for write
PRV_SUBS = ""
PRV_ESECS = -1000
PRV_EMSECS = 0
Records = RT_DBaseRecords(DB)
for(rec=0,Records-1) {
# At this point, any previous SUB will have been written. We only remove early lines of current SUB
SSECS = RT_DBaseGetField(DB,rec,SSECS_FLD)
SMSECS = RT_DBaseGetField(DB,rec,SMSECS_FLD)
ESECS = RT_DBaseGetField(DB,rec,ESECS_FLD)
EMSECS = RT_DBaseGetField(DB,rec,EMSECS_FLD)
SUBS = RT_DBaseGetField(DB,rec,SUBS_FLD)
Tim = TimeStr(SSECS,SMSECS,Comma) + " --> " + TimeStr(ESECS,EMSECS,Comma)
(DEBUG) ? RT_DebugF("##################################\n%d\n%s\nPRV=%s\nCUR=%s",rec+1,Tim,PRV_SUBS,SUBS) : NOP
GapToPRV = (SSECS * 1000 + SMSECS) - (PRV_ESECS * 1000 + PRV_EMSECS) # Gap in milli-secs
if(GapToPrv > GAP_MS) { # Separated sub, not scrolling
(DEBUG) ? RT_DebugF("*** GAP SPLIT *** (Gap=%dmsecs)\n%d\n%s\n%s\n",GapToPrv,rec+1,Tim,SUBS,name="SUBS: ") : NOP
RT_WriteFile(SRT,"%d\n%s\n%s\n\n",rec+1,Tim,SUBS,Append=True)
} else { # Try to remove duplicated scrolling sub lines
nLines=SUBS.RT_TxtQueryLines()
pLines=PRV_SUBS.RT_TxtQueryLines()
OLap = Min(nLines-1,pLines-1)
Matched = 0
# Find end lines of prev sub that match start lines of current sub
For(i = OLap, 1, -1 ) {
for(j=0,i-1) {
csl = RT_TxtGetLine(SUBS ,Line=j)
psl = RT_TxtGetLine(PRV_SUBS,Line=pLines-Olap+j)
if(StrCmp(csl,psl)!=0) { Break }
}
if(j==i) { # Bingo
Matched = i
Break
}
}
if(matched>0) {
s = ""
# Get non-matching lines of current sub (not scrolling)
for(i=matched,nLines-1) {
s = s + RT_TxtGetLine(SUBS,Line=i) + ( i==nLines-1 ? "" : Chr(10) )
}
SUBS = s
(DEBUG) ? RT_DebugF("Matched = %d\nNewSub = %s",matched,SUBS) : NOP
}
RT_WriteFile(SRT,"%d\n%s\n%s\n\n",rec+1,Tim,SUBS,Append=True)
(DEBUG) ? RT_DebugF("%d\n%s\n%s\n",rec+1,Tim,SUBS,name="SUBS: ") : NOP
}
PRV_SUBS = RT_DBaseGetField(DB,rec,SUBS_FLD) # Remember original current sub (not un-scrolled sub)
PRV_ESECS = ESECS
PRV_EMSECS= EMSECS
}
Function TimeStr(int ts, int tms, Bool Comma) {
Hrs=(ts/3600) ts=ts%3600
Mins=(ts/60) ts=ts%60
return RT_String("%02d:%02d:%02d%c%03d",Hrs,Mins,ts,Comma?RT_Ord(","):RT_Ord("."),tms)
}
MessageClip(RT_String("All Done (created '%s')",SRT))
StainlessS
7th July 2025, 07:17
Post #4 of 4.
SrtRenderCompareSubs.avs
#########
# SrtRenderCompareSubs.avs
#
# Requires TextSub() from VsFilter.dll # https://github.com/pinterf/xy-VSFilter/releases
#
# Shows FIXED.srt and compares with Resulting unscrolled subs Result.srt
# If Fixed.srt.DB present, then uses it to establish length of blank clip (else guesses 3 hours).
#########
SRT1 = ".\FIXED.srt" # Fixed original srt
SRT2 = ".\Result.srt" # Comparison srt (compare original with fixed), "" = Just show original.
#SRT2 = "" # Comparison srt (compare original with fixed), "" = Just show original.
FPS = 25.0 # Original FrameRate
#####################
DB = Srt1 + ".DB"
SRT1 = RT_GetFullPathName(SRT1)
SRT2 = (SRT2!="") ? RT_GetFullPathName(SRT2) : SRT2
#####################
### DBase Fields
# TypeStr="iiiis512" # DBase 5 fields, 4 * int fields, String[512] field.
SSECS_FLD = 0 # Start Seconds field
SMSECS_FLD = 1 # Start millisecs field
ESECS_FLD = 2 # End Seconds field
EMSECS_FLD = 3 # End millisecs field
SUBS_FLD = 4 # Subtitle text String field
#####################
DB = RT_GetFullPathName(DB)
Records = Exist(DB) ? RT_DBaseRecords(DB) : 0
Seconds = (Records<=0 ? 03*3600 : RT_DBaseGetField(DB,Records-1,ESECS_FLD)) + 30
Frames = (Seconds * FPS).Round
Last = BlankClip(Width=1280,Height=720,Length=Frames,Pixel_Type="YV12",fps=FPS)
(SRT2=="") ? TextSub(SRT1) : StackHorizontal(TextSub(SRT1),TextSub(SRT2))
ShowTime()
Return Last
StainlessS
8th July 2025, 11:10
MicroFiche_Unscroller(v2).7z
reposted in post #28.
Bugfix update. 1 Bugfix + several cosmetic changes.
[The 4 posted scripts also updated]
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.