SHOW:
|
|
- or go back to the newest paste.
| 1 | - | function frame2time(clip c, int f){
|
| 1 | + | function frame2time(clip c, int f) |
| 2 | - | rawtime= f/c.framerate |
| 2 | + | {
|
| 3 | - | hours= rawtime/3600.0 |
| 3 | + | rawtime = f/c.framerate |
| 4 | - | minutes= frac(hours)*60.0 |
| 4 | + | hours = rawtime/3600.0 |
| 5 | - | seconds= frac(minutes)*60.0 |
| 5 | + | minutes = frac(hours)*60.0 |
| 6 | - | time=string(floor(hours),"%1.0f")+":"+string(floor(minutes),"%02.0f")+":"+string(seconds,"%05.2f") |
| 6 | + | seconds = frac(minutes)*60.0 |
| 7 | - | return time |
| 7 | + | time =string(floor(hours),"%1.0f")+":"+string(floor(minutes),"%02.0f")+":"+string(seconds,"%05.2f") |
| 8 | - | } |
| 8 | + | |
| 9 | return time | |
| 10 | - | function prepareline(clip c, string s, int f){
|
| 10 | + | } |
| 11 | - | result=RT_StrReplace(s,"0:00:00.00",frame2time(c,f)) |
| 11 | + | |
| 12 | - | result=RT_StrReplace(result,"0:00:01.00",frame2time(c,f+round(c.framerate))) |
| 12 | + | function prepareline(clip c, string s, int f) |
| 13 | - | return result |
| 13 | + | {
|
| 14 | - | } |
| 14 | + | result = RT_StrReplace(s,"0:00:00.00",frame2time(c,f)) |
| 15 | result = RT_StrReplace(result,"0:00:01.00",frame2time(c,f+round(c.framerate))) | |
| 16 | - | ffmpegSource2("C:\Users\Seedmanc\Desktop\guiminer\avisynth\imas_question_pause.mkv")
|
| 16 | + | |
| 17 | return result | |
| 18 | } | |
| 19 | - | filename = "c:\Users\Seedmanc\Desktop\guiminer\avisynth\subhelp\subtitle.ass" |
| 19 | + | |
| 20 | - | tbX=198 #Coordinates of the textbox for 720p |
| 20 | + | directshowsource("test_hibiki.mkv")
|
| 21 | - | tbY=584 |
| 21 | + | |
| 22 | - | tbW=880 |
| 22 | + | |
| 23 | - | tbH=92 |
| 23 | + | filename = "subtitle.ass" |
| 24 | - | stringtemplate="Dialogue: 0,0:00:00.00,0:00:01.00,DefaultStyle,,0000,0000,0000,," |
| 24 | + | stringtemplate = "Dialogue: 0,0:00:00.00,0:00:01.00,DefaultStyle,,0000,0000,0000,," |
| 25 | ||
| 26 | - | writefilestart(filename,"chr(13)",append=true) #Starting with a new line just to be sure. |
| 26 | + | #Coordinates of the textbox for 720p |
| 27 | - | textbox=crop(tbx,tby,tbw,tbh).coloryuv(autogain=true,autowhite=true ).levels(8,1,255-8,0,255,coring=false) |
| 27 | + | tbX = 198 |
| 28 | - | detected=false |
| 28 | + | tbY = 584 |
| 29 | tbW = 880 | |
| 30 | tbH = 92 | |
| 31 | ||
| 32 | #Starting with a new line just to be sure. | |
| 33 | writefilestart(filename,"chr(13)",append=true) | |
| 34 | ||
| 35 | textbox = crop(tbx,tby,tbw,tbh).coloryuv(autogain=true,autowhite=true ).levels(8,1,255-8,0,255,coring=false) | |
| 36 | detected = false | |
| 37 | ||
| 38 | temp=""" detected=true \ | |
| 39 | writefile(filename,"prepareline(last,stringtemplate,current_frame)",append=true) last""" | |
| 40 | t="overlay(blankclip(width=tbw,height=tbh,color=$00FF00),x=tbx,y=tby,opacity=0.3 ) " | |
| 41 | #^ indicates detection by placing green bar over the textbox when it occurs | |
| 42 | ||
| 43 | - | #assumefps(270) # You can make the script scan your video faster by raising the framerate here, if you're running it via player. It works at ~330 fps for me. |
| 43 | + | |
| 44 | tal=textbox.rt_averageluma | |
| 45 | (tal<235 && tal>190)? \ | |
| 46 | eval(t+"(detected==false)? \ | |
| 47 | eval(temp):last \ | |
| 48 | "): \ | |
| 49 | eval( "detected=false last") | |
| 50 | """) | |
| 51 | ||
| 52 | assumefps(270) # You can make the script scan your video faster by raising the framerate here, if you're running it via player. It works at ~330 fps for me. |