Quantcast
Channel: Adobe Community: Message List - Premiere Pro
Viewing all articles
Browse latest Browse all 208900

Re: Using timecode as subtitle showing date and time

$
0
0

No, But for me it is not comfortable to use this program for subtitling.

I have written script on autohotkey, which converts srt, txt and so on to premiere titles format and creates edl.

I have modified it for your situation.

Text = D:\temp\1.txt          ; change to file with subtitles watchfolder = D:\temp\             ; change to folder in which will be created titles (after script starts all prtl files in that folder will be deleted) prtlPath = D:\temp\TITRI\       ; change to title template. It has to be 1 line and name - "1.ptrl" EDL = D:\temp\1.edl       ;  change to path to edl. (after script starts this file will be deleted)   SetBatchLines, -1 FileEncoding, UTF-16 FileDelete, %watchfolder%\*.prtl Loop, read, %Text% {    If A_LoopReadLine is digit    {       str .= "`n"       continue    }    str .= A_LoopReadLine . "`n" } string := RegExReplace(Trim(str,"`r`n"), "\R[\R\s]+", "`n`n") SubStrList := RegExSplit(string, "S)\n\n") for index, substring in SubStrList                string%A_Index% := substring, Lines%A_Index% := SymbCount(substring, "`n")+1 n := SubStrList.MaxIndex() Loop % n {    String := string%A_Index%    k := Lines%A_Index% - 1    FileRead, prtl, %prtlPath%\%k%.prtl    XPos := 0    Loop, parse, String, `n, `r    {                         if (A_Index = 1)                       {                                          Timecode .= A_LoopField "`n"                                          Continue                       }                       if (A_LoopField = "")                                          Continue                         StrLength := StrLen(A_LoopField ) + 1                       XPos := RegExMatch(prtl, "", "", XPos + 1)                       prtl := RegExReplace(prtl, " 1)                       {                                          k:=k-1                                          prtl := RegExReplace(prtl, ".*?"                                                                                                                                                  , "" LoopField ""                                                                                                                                                  , "", 1, XPos - 1)                       }                       Else                                          prtl := RegExReplace(prtl, ".*?"                                                                                                                                                  , "" LoopField "")                }      FileName := "title" . SubStr("000", 1, -(StrLen(A_Index))) . A_Index . ".prtl"    FileAppend, % prtl, %watchfolder%\%FileName% }  n:=1 TimecodesList := RegExReplace(Trim(Timecode,"`r`n"), " ", "") Loop, parse, TimecodesList, `n, `r {    Timecodes = %A_LoopField%    StringReplace, Timecodes, Timecodes, -, , All    StringSplit, string, Timecodes, >   x = % string1    xx = % string2    StringSplit, y, x, `,    z := Ceil(y2*25/1000)    SetFormat, Float, 02.0    z += 0.0    StringSplit, yy, xx, `,    zz := Ceil(yy2*25/1000)    SetFormat, Float, 02.0    zz += 0.0     varTimecode1 = %y1%:%z%    varTimecode2  = %yy1%:%zz%     StringSplit, Timecode1Array, varTimecode1, :    StringSplit, Timecode2Array, varTimecode2, :     Digit4:    if (Timecode2Array4 < Timecode1Array4)    {                Timecode2Array4 += 25                Timecode2Array3 -= 1                DurationArray4 := Timecode2Array4 - Timecode1Array4                gosub, Digit3    }    if (Timecode2Array4 >= Timecode1Array4)                DurationArray4 := Timecode2Array4 - Timecode1Array4      Digit3:    if (Timecode2Array3 < Timecode1Array3)    {                Timecode2Array3 += 60                Timecode2Array2 -= 1                DurationArray3 := Timecode2Array3 - Timecode1Array3                gosub, Digit2    }    if (Timecode2Array3 >= Timecode1Array3)                DurationArray3 := Timecode2Array3 - Timecode1Array3                    Digit2:              if (Timecode2Array2 < Timecode1Array2)    {                Timecode2Array2 += 24                Timecode2Array1 -= 1                DurationArray2 := Timecode2Array2 - Timecode1Array2                gosub, Digit1    }    if (Timecode2Array2 >= Timecode1Array2)                DurationArray2 := Timecode2Array2 - Timecode1Array2      Digit1:    if (Timecode2Array1 < Timecode1Array1)    {                msgbox, Timecode2Array1 %Timecode2Array1% < Timecode1Array1 %Timecode1Array1%                msgbox, The "Start" timecode cannot be less than the "End" timecode.                ExitApp    }    if (Timecode2Array1 >= Timecode1Array1)                {                                    DurationArray1 := Timecode2Array1 - Timecode1Array1 + 1                                    goto, EndProcess                }      EndProcess:    SetFormat, Float, 02.0    Loop, 4                DurationArray%A_Index% += 0.0    TitleDuration%n% = %DurationArray1%:%DurationArray2%:%DurationArray3%:%DurationArray4%     StartTimecode%n% = %y1%:%z%    EndTimecode%n% = %yy1%:%zz%    n++ }   EDLvar = TITLE: Sequence 01`n`n Var = 000 SetFormat, float, 03.0 loop % n - 1 {    StartTimecode := StartTimecode%A_Index%    EndTimecode := EndTimecode%A_Index%    TitleDuration := TitleDuration%A_Index%    TitleName := "title" . SubStr("000", 1, -(StrLen(A_Index))) . A_Index     Var += 1.0    EDLvar .= Var "  AX       V     C        01:00:00:00 " TitleDuration " " StartTimecode " " EndTimecode "`n* FROM CLIP NAME: " TitleName "`n`n" } FileDelete, %EDL% FileAppend, % EDLvar, %EDL%, UTF-8 Msgbox, Done ExitApp         SymbCount(ByRef string, symb) {                count := 0                loop, Parse, string                                    (A_LoopField == symb) && ++count                return count }     RegExSplit(ByRef in, delim = "") {                pos := 0, start := 1, Obj := []                while, pos := RegExMatch(in, delim, match, start)                                    Obj.Insert(SubStr(in, start, pos - start)), start := pos + StrLen(match)                Obj.Insert(SubStr(in, start))                return Obj }


Viewing all articles
Browse latest Browse all 208900

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>