VideoHelp Forum




+ Reply to Thread
Results 1 to 2 of 2
  1. I need to stretch (or actually squeeze) an SRT file.

    In order to avoid jerky playback in PAL DVD I'm going to encode 23,976 fs at 25 fs, ie no frame duplicating. When doing so audio and subtitles will lag more and more.

    Is there a program that does a time warp on an SRT file?
    Preferable based on 23,976/25-info
    Quote Quote  
  2. Member mats.hogberg's Avatar
    Join Date
    Jul 2002
    Location
    Sweden (PAL)
    Search Comp PM
    I've done a very simple VBS script to do this for .ssa files. It should be equally easy to alter the times in a .srt.
    Code:
    dim a
    set a=WScript.Arguments
    If a.Count<2 then
    	REM *** Error out - input and output file needed
    	Quit
    End If
    factor=25/23.976
    Set fso = CreateObject("Scripting.FileSystemObject")
    set i=fso.openTextFile(a(0),1)
    set o=fso.openTextFile(a(1),2, true)
    while not i.AtEndOfStream
    	ln=i.ReadLine
    	if left(ln,9)="Dialogue:" then
    		REM *** OK; Assume this is a line with subs
    		row=split(ln,",")
    		s=row(1)
    		e=row(2)
    		row(1)=toTimeString(toHundreds(row(1),factor))
    		row(2)=toTimeString(toHundreds(row(2),factor))
    		ln=Join(row,",")
    	end if
    	o.WriteLine ln
    wend
    i.close
    o.close
    set fso=nothing
    function toHundreds(s,f)
    	dim a
    	a=split(s,":")
    	h=a(0)
    	m=a(1)
    	s_temp=a(2)
    	b=split(s_temp,".")
    	s=b(0)
    	hundreds=b(1)
    	hndreds=(cInt(h)*360000)+(cInt(m)*60*100)+(cInt(s)*100)+hundreds
    	toHundreds=cLng(hndreds/f)
    End Function
    
    function toTimeString(hundreds)
    	h=Int(hundreds/360000)
    	hundreds=hundreds-(h*360000)
    	
    	m=Int(hundreds/6000)
    	hundreds=hundreds-(m*6000)
    	
    	s=Int(hundreds/100)
    	hundreds=hundreds-(s*100)
    	
    	toTimeString=cStr(h) & ":" & right("0" & cStr(m),2) & ":" & right("0" & cStr(s),2) & "." & right("0" & cStr(hundreds),2)
    End Function
    /Mats
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!