Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#21 | Link | |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Quote:
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).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 29th June 2025 at 13:19. |
|
|
|
|
|
|
#23 | Link |
|
Registered User
Join Date: Jun 2025
Posts: 10
|
Help with converted timed text subtitle...
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.
|
|
|
|
|
|
#24 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
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.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#25 | Link | |
|
Registered User
Join Date: Jun 2025
Posts: 10
|
re: Help with converted timed text subtitle...
Quote:
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. |
|
|
|
|
|
|
#26 | Link |
|
Old Batch Hacker
Join Date: Oct 2006
Location: At Home
Posts: 80
|
I created subs using whisper. They are here. https://www.sendspace.com/file/paxkr8
|
|
|
|
|
|
#27 | Link | |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Hi MicroFiche, [EDIT: we had up to 34c here, not quite so bearable humidity]
https://www.mediafire.com/file/ctpxb...oFiche.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 Quote:
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.p...58#post2020458
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 7th July 2025 at 07:20. |
|
|
|
|
|
|
#28 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Post #1 of 4.
Here, Final version unscroller thingy. https://www.mediafire.com/file/e10yi...er(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 Code:
# 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)
}
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th July 2025 at 11:07. |
|
|
|
|
|
#29 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Post #2 of 2
2_SrtShowDB.avs Code:
# 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")
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th July 2025 at 11:07. |
|
|
|
|
|
#30 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Post #3 of 3.
3_SrtUnScrollWrite.avs Code:
# 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))
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th July 2025 at 11:08. |
|
|
|
|
|
#31 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
Post #4 of 4.
SrtRenderCompareSubs.avs Code:
######### # 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
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th July 2025 at 11:08. |
|
|
|
|
|
#32 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
|
MicroFiche_Unscroller(v2).7z
reposted in post #28. Bugfix update. 1 Bugfix + several cosmetic changes. [The 4 posted scripts also updated]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
![]() |
| Tags |
| timed text |
| Thread Tools | |
| Display Modes | |
|
|