#############################################################################
####################### -Options, Settings- #############################
#############################################################################
vidfile = "VIDEOFILE"
subfile = "SUBFILE"
group = "GROUPNAME"
#Unless upscaling leave these as 0, else add desired px values
VidClp_width = 0 #1280
VidClp_height = 0 #720
# Adding blank frames in front or back of the VidClp
Front_FramePadding = 0
Back_FramePadding = 0
Logging = false
display_group = true
displayFramNum = false
display_timecode = false
display_subtitles = true
Notes = "" # If none then keep empty quotes
#############################################################################
################## -Should Not Need To Change- ##########################
#############################################################################
#c1 = ChangeFPS(c1,29.950)
#c2 = ChangeFPS(c2,29.950)
## creating file and set path for future log entries:
(Logging)
\ ? Eval("""
folder = ScriptDir()
(RightStr(folder, 1) == "\")
\ ? SetLogParams(folder + group + "_ScriptLog.log", LOG_INFO)
\ : SetLogParams(folder + "\" + group + "_ScriptLog.log", LOG_INFO)
LogMsg(string("Starting Logger"), LOG_INFO)
""")
\:nop() # Undefined()
/*
# Alt to FFVideoSource but needs other changes for script to work right
c1 = LWLibavVideoSource(vidfile,format="YUV420P8")
*/
c1 = FFVideoSource (vidfile, varprefix="c1_", colorspace="YV12")
#Add blank frames to vid file if needed
(StrLen(subfile) == 0)
\ ? Eval("""
F_blank1 = BlankClip(c1, length= Front_FramePadding)
B_blank1 = BlankClip(c1, length= Back_FramePadding)
c1 = F_blank1+c1+B_blank1
""")
\: nop()
w = c1.Width ()
h = c1.Height ()
wm4 = (w + 3) / 4 * 4
hm4 = (h + 3) / 4 * 4
target_width = (VidClp_width > 0) ? VidClp_width : w
target_height = (VidClp_height > 0) ? VidClp_height : h
matrix = (1 <= c1_FFCOLOR_SPACE <= 4) ? "709"
\ : (c1_FFCOLOR_SPACE >= 5) ? "601" : nop()
par = (c1_FFSAR_NUM > 0 && c1_FFSAR_DEN > 0)
\ ? Float (c1_FFSAR_NUM) / Float (c1_FFSAR_DEN)
\ : nop()
tv_range = (c1_FFCOLOR_RANGE != 2)
#Adding Subs based on the file ext
Subs = (StrLen(subfile) > 0 && display_subtitles)
\ ? (RightStr(LCase(subfile), 3) == "sup")
\ ? SupTitle(c1,subfile)
\ : (RightStr(LCase(subfile), 3) == "sub")
\ ? VSFilter_Vobsub(c1,subfile)
\ : AssRender(c1,subfile)
\: nop()
#Add blank frames to vid+sub file if needed
(StrLen(subfile) > 0 && display_subtitles)
\ ? Eval("""
F_blank2 = BlankClip(Subs, length= Front_FramePadding)
B_blank2 = BlankClip(Subs, length= Back_FramePadding)
F_blank2+Subs+B_blank2
""")
\: nop()
(VersionNumber () >= 2.6) ? last
\ : AddBorders (0, 0, wm4 - w, hm4 - h)
#upscale
((par > 0) ?
\ (target_width != c1.Width() || target_height != c1.Height())
\ ? Dither_srgb_display (par=par, matrix=matrix, tv_range=tv_range, w=target_width, h=target_height)
\ : Dither_srgb_display (par=par, matrix=matrix, tv_range=tv_range)
\ :(target_width != c1.Width() || target_height != c1.Height())
\ ? Dither_srgb_display (autopar=True, matrix=matrix, tv_range=tv_range, w=target_width, h=target_height)
\ : Dither_srgb_display (autopar=True, matrix=matrix, tv_range=tv_range)
\)
#for screenshot macro and info in screenshot
screenShotGroup = (target_width > c1.Width() || target_height > c1.Height())
\ ? group + "_Upscaled" : group
cmt1 = (target_width > c1.Width() || target_height > c1.Height())
\ ? group + "\nupscaled" : group
cmt2 = (display_group) ?
\ cmt1 : ""
FFInfoEX(framenum=displayFramNum,vfrtime=display_timecode, cfrtime=false, frametype=false, x=last.width-6, y=4, cmt=cmt2, align=9, shorttime=true)
# Adding notes on screen
(StrLen(Notes) > 0 )
\ ? Subtitle("Note: " + Notes, lsp=0,text_color=$fd2f2f,size=24,align=7,y=5)
\ : Subtitle("")