StainlessS
5th September 2012, 21:58
Continued from previous post.
AVS Template (Most entries unused)
AVSFile="[AVSFILE]" # Name of THIS file
VideoFile="[VIDEOFILE]" # Source file
CMDFile="[CMDFILE]" # Name of BATCH file
BaseFile="[BASEFILE]" # Base Filename, no path and ".Ext" changed to "_Ext"
OrigX=[ORIGX] # Original Width
OrigY=[ORIGY] # Original Height
SizeX=[SIZEX] # Output Width
SizeY=[SIZEY] # Output Height
CropX=[CROPX] # Crop Left
CropY=[CROPY] # Crop Top
CropW=[CROPW] # Crop Width
CropH=[CROPH] # Crop Height
CropWRel=[CROPWREL] # Crop Width relative
CropHRel=[CROPHREL] # Crop Height relative
CropRGT=[CROPRGT] # Crop Right Edge, abs
CropBOT=[CROPBOT] # Crop Bottom Edge, abs
AutoLevel=[AUTOLEVEL] # True If Auto Level
ALMin=[ALMIN] # AutoLevel Minimum
ALMax=[ALMAX] # AutoLevel Maximum
CSMin=[CSMIN] # Colorspace Minimum
CSMax=[CSMAX] # Colorspace Maximum
FFDAR=[FFDAR] # Full Frame DAR before cropping
FFSAR=[FFSAR] # Full Frame SAR before cropping
DAR=[DAR] # DAR After Crop/Resize
SAR=[SAR] # Sample ie Pixel Aspect Ratio
# --------------
DirectShowSource(VideoFile).ConvertToYV12().Trim(0,0)
Crop(CropX,CropY,CropW,CropH)
(AutoLevel) ? Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) : NOP
(SizeX != Width && SizeY != Height) ? Spline36Resize(SizeX,SizeY) : NOP
SignalDAR(DAR) # Tell MeGUI the new Resized/Cropped Display Aspect Ratio
return last
# --------------
# From MeGUI Wiki:
Function SignalDAR(float DAR){global MeGUI_darx=Round(1000*DAR) global MeGUI_dary=1000} # Signal DAR for MEGUI (Name change from SetDar)
Cmd Template
"D:\TEST\ffmpeg.exe" -i "[AVSFILE]" -vcodec libx264 -crf 21.5 -s [SIZEX]x[SIZEY] -aspect [DAR] -acodec libvo_aacenc -ab 128k "D:\OUT\[BASEFILE].MKV"
Log Template
The input Video file is :- [VIDEOFILE]
The created AVS file is :- [AVSFILE]
The created CMD file is :- [CMDFILE] eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- [BASEFILE]
Original Size :- [ORIGX]x[ORIGY] with a DAR of [FFDAR] and SAR of [FFSAR]
Resize to :- [SIZEX]x[SIZEY] with Cropping [CROPX],[CROPY],[CROPW],[CROPH], DAR = [DAR], SAR = [SAR]
Resize Relative Cropping :- CropW Relative = [CROPWREL], CropH Relative = [CROPHREL]
Resize Abs Cropping :- CropRight Abs = [CROPRGT], CropBottom Abs = [CROPBOT]
AutoLevel :- [AUTOLEVEL]
Levels if AUTOLEVEL True :- Levels([ALMIN],1.0,[ALMAX],[CSMIN],[CSMAX],Coring=False)
AVS Output
AVSFile="D:\OUT\1_mpg.AVS" # Name of THIS file
VideoFile="D:\VID\1.mpg" # Source file
CMDFile="D:\OUT\1_mpg.CMD" # Name of BATCH file
BaseFile="1_mpg" # Base Filename, no path and ".Ext" changed to "_Ext"
OrigX=448 # Original Width
OrigY=304 # Original Height
SizeX=472 # Output Width
SizeY=348 # Output Height
CropX=18 # Crop Left
CropY=0 # Crop Top
CropW=412 # Crop Width
CropH=304 # Crop Height
CropWRel=-18 # Crop Width relative
CropHRel=0 # Crop Height relative
CropRGT=18 # Crop Right Edge, abs
CropBOT=0 # Crop Bottom Edge, abs
AutoLevel=true # True If Auto Level
ALMin=22 # AutoLevel Minimum
ALMax=231 # AutoLevel Maximum
CSMin=16 # Colorspace Minimum
CSMax=235 # Colorspace Maximum
FFDAR=1.474 # Full Frame DAR before cropping
FFSAR=1.000 # Full Frame SAR before cropping
DAR=1.356 # DAR After Crop/Resize
SAR=1.000 # Sample ie Pixel Aspect Ratio
# --------------
DirectShowSource(VideoFile).ConvertToYV12().Trim(0,0)
Crop(CropX,CropY,CropW,CropH)
(AutoLevel) ? Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) : NOP
(SizeX != Width && SizeY != Height) ? Spline36Resize(SizeX,SizeY) : NOP
SignalDAR(DAR) # Tell MeGUI the new Resized/Cropped Display Aspect Ratio
return last
# --------------
# From MeGUI Wiki:
Function SignalDAR(float DAR){global MeGUI_darx=Round(1000*DAR) global MeGUI_dary=1000} # Signal DAR for MEGUI (Name change from SetDar)
Log Output
The input Video file is :- D:\VID\1.mpg
The created AVS file is :- D:\OUT\1_mpg.AVS
The created CMD file is :- D:\OUT\1_mpg.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 1_mpg
Original Size :- 448x304 with a DAR of 1.474 and SAR of 1.000
Resize to :- 472x348 with Cropping 18,0,412,304, DAR = 1.356, SAR = 1.000
Resize Relative Cropping :- CropW Relative = -18, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 18, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(22,1.0,231,16,235,Coring=False)
The input Video file is :- D:\VID\2.avi
The created AVS file is :- D:\OUT\2_avi.AVS
The created CMD file is :- D:\OUT\2_avi.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 2_avi
Original Size :- 640x360 with a DAR of 1.778 and SAR of 1.000
Resize to :- 472x266 with Cropping 0,0,640,360, DAR = 1.774, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(17,1.0,239,16,235,Coring=False)
The input Video file is :- D:\VID\3.MP4
The created AVS file is :- D:\OUT\3_MP4.AVS
The created CMD file is :- D:\OUT\3_MP4.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 3_MP4
Original Size :- 640x480 with a DAR of 1.333 and SAR of 1.000
Resize to :- 472x354 with Cropping 0,0,640,480, DAR = 1.333, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(12,1.0,255,16,235,Coring=False)
The input Video file is :- D:\VID\4.flv
The created AVS file is :- D:\OUT\4_flv.AVS
The created CMD file is :- D:\OUT\4_flv.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 4_flv
Original Size :- 432x240 with a DAR of 1.800 and SAR of 1.000
Resize to :- 472x262 with Cropping 0,0,432,240, DAR = 1.802, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(16,1.0,236,16,235,Coring=False)
The input Video file is :- D:\VID\5.wmv
The created AVS file is :- D:\OUT\5_wmv.AVS
The created CMD file is :- D:\OUT\5_wmv.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 5_wmv
Original Size :- 720x540 with a DAR of 1.333 and SAR of 1.000
Resize to :- 472x354 with Cropping 0,0,720,540, DAR = 1.333, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(1,1.0,255,16,235,Coring=False)
Group Command output (will not show them individually, they look the same).
"D:\TEST\ffmpeg.exe" -i "D:\OUT\1_mpg.AVS" -vcodec libx264 -crf 21.5 -s 472x348 -aspect 1.356 -acodec libvo_aacenc -ab 128k "D:\OUT\1_mpg.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\2_avi.AVS" -vcodec libx264 -crf 21.5 -s 472x266 -aspect 1.774 -acodec libvo_aacenc -ab 128k "D:\OUT\2_avi.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\3_MP4.AVS" -vcodec libx264 -crf 21.5 -s 472x354 -aspect 1.333 -acodec libvo_aacenc -ab 128k "D:\OUT\3_MP4.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\4_flv.AVS" -vcodec libx264 -crf 21.5 -s 472x262 -aspect 1.802 -acodec libvo_aacenc -ab 128k "D:\OUT\4_flv.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\5_wmv.AVS" -vcodec libx264 -crf 21.5 -s 472x354 -aspect 1.333 -acodec libvo_aacenc -ab 128k "D:\OUT\5_wmv.MKV"
Pause
Probably not optimal (I dont use ffmpeg much) but works pretty good.
Output MKV's all AutoCropped/Resized and AutoLeveled.
Alternatively, could feed the avs files into MeGUI and do them that way, also signals DAR to MeGUI.
(MeGUI AutoEncode Batcher, might assist if you have a lot of avs files to encode).
AVS Template (Most entries unused)
AVSFile="[AVSFILE]" # Name of THIS file
VideoFile="[VIDEOFILE]" # Source file
CMDFile="[CMDFILE]" # Name of BATCH file
BaseFile="[BASEFILE]" # Base Filename, no path and ".Ext" changed to "_Ext"
OrigX=[ORIGX] # Original Width
OrigY=[ORIGY] # Original Height
SizeX=[SIZEX] # Output Width
SizeY=[SIZEY] # Output Height
CropX=[CROPX] # Crop Left
CropY=[CROPY] # Crop Top
CropW=[CROPW] # Crop Width
CropH=[CROPH] # Crop Height
CropWRel=[CROPWREL] # Crop Width relative
CropHRel=[CROPHREL] # Crop Height relative
CropRGT=[CROPRGT] # Crop Right Edge, abs
CropBOT=[CROPBOT] # Crop Bottom Edge, abs
AutoLevel=[AUTOLEVEL] # True If Auto Level
ALMin=[ALMIN] # AutoLevel Minimum
ALMax=[ALMAX] # AutoLevel Maximum
CSMin=[CSMIN] # Colorspace Minimum
CSMax=[CSMAX] # Colorspace Maximum
FFDAR=[FFDAR] # Full Frame DAR before cropping
FFSAR=[FFSAR] # Full Frame SAR before cropping
DAR=[DAR] # DAR After Crop/Resize
SAR=[SAR] # Sample ie Pixel Aspect Ratio
# --------------
DirectShowSource(VideoFile).ConvertToYV12().Trim(0,0)
Crop(CropX,CropY,CropW,CropH)
(AutoLevel) ? Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) : NOP
(SizeX != Width && SizeY != Height) ? Spline36Resize(SizeX,SizeY) : NOP
SignalDAR(DAR) # Tell MeGUI the new Resized/Cropped Display Aspect Ratio
return last
# --------------
# From MeGUI Wiki:
Function SignalDAR(float DAR){global MeGUI_darx=Round(1000*DAR) global MeGUI_dary=1000} # Signal DAR for MEGUI (Name change from SetDar)
Cmd Template
"D:\TEST\ffmpeg.exe" -i "[AVSFILE]" -vcodec libx264 -crf 21.5 -s [SIZEX]x[SIZEY] -aspect [DAR] -acodec libvo_aacenc -ab 128k "D:\OUT\[BASEFILE].MKV"
Log Template
The input Video file is :- [VIDEOFILE]
The created AVS file is :- [AVSFILE]
The created CMD file is :- [CMDFILE] eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- [BASEFILE]
Original Size :- [ORIGX]x[ORIGY] with a DAR of [FFDAR] and SAR of [FFSAR]
Resize to :- [SIZEX]x[SIZEY] with Cropping [CROPX],[CROPY],[CROPW],[CROPH], DAR = [DAR], SAR = [SAR]
Resize Relative Cropping :- CropW Relative = [CROPWREL], CropH Relative = [CROPHREL]
Resize Abs Cropping :- CropRight Abs = [CROPRGT], CropBottom Abs = [CROPBOT]
AutoLevel :- [AUTOLEVEL]
Levels if AUTOLEVEL True :- Levels([ALMIN],1.0,[ALMAX],[CSMIN],[CSMAX],Coring=False)
AVS Output
AVSFile="D:\OUT\1_mpg.AVS" # Name of THIS file
VideoFile="D:\VID\1.mpg" # Source file
CMDFile="D:\OUT\1_mpg.CMD" # Name of BATCH file
BaseFile="1_mpg" # Base Filename, no path and ".Ext" changed to "_Ext"
OrigX=448 # Original Width
OrigY=304 # Original Height
SizeX=472 # Output Width
SizeY=348 # Output Height
CropX=18 # Crop Left
CropY=0 # Crop Top
CropW=412 # Crop Width
CropH=304 # Crop Height
CropWRel=-18 # Crop Width relative
CropHRel=0 # Crop Height relative
CropRGT=18 # Crop Right Edge, abs
CropBOT=0 # Crop Bottom Edge, abs
AutoLevel=true # True If Auto Level
ALMin=22 # AutoLevel Minimum
ALMax=231 # AutoLevel Maximum
CSMin=16 # Colorspace Minimum
CSMax=235 # Colorspace Maximum
FFDAR=1.474 # Full Frame DAR before cropping
FFSAR=1.000 # Full Frame SAR before cropping
DAR=1.356 # DAR After Crop/Resize
SAR=1.000 # Sample ie Pixel Aspect Ratio
# --------------
DirectShowSource(VideoFile).ConvertToYV12().Trim(0,0)
Crop(CropX,CropY,CropW,CropH)
(AutoLevel) ? Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) : NOP
(SizeX != Width && SizeY != Height) ? Spline36Resize(SizeX,SizeY) : NOP
SignalDAR(DAR) # Tell MeGUI the new Resized/Cropped Display Aspect Ratio
return last
# --------------
# From MeGUI Wiki:
Function SignalDAR(float DAR){global MeGUI_darx=Round(1000*DAR) global MeGUI_dary=1000} # Signal DAR for MEGUI (Name change from SetDar)
Log Output
The input Video file is :- D:\VID\1.mpg
The created AVS file is :- D:\OUT\1_mpg.AVS
The created CMD file is :- D:\OUT\1_mpg.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 1_mpg
Original Size :- 448x304 with a DAR of 1.474 and SAR of 1.000
Resize to :- 472x348 with Cropping 18,0,412,304, DAR = 1.356, SAR = 1.000
Resize Relative Cropping :- CropW Relative = -18, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 18, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(22,1.0,231,16,235,Coring=False)
The input Video file is :- D:\VID\2.avi
The created AVS file is :- D:\OUT\2_avi.AVS
The created CMD file is :- D:\OUT\2_avi.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 2_avi
Original Size :- 640x360 with a DAR of 1.778 and SAR of 1.000
Resize to :- 472x266 with Cropping 0,0,640,360, DAR = 1.774, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(17,1.0,239,16,235,Coring=False)
The input Video file is :- D:\VID\3.MP4
The created AVS file is :- D:\OUT\3_MP4.AVS
The created CMD file is :- D:\OUT\3_MP4.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 3_MP4
Original Size :- 640x480 with a DAR of 1.333 and SAR of 1.000
Resize to :- 472x354 with Cropping 0,0,640,480, DAR = 1.333, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(12,1.0,255,16,235,Coring=False)
The input Video file is :- D:\VID\4.flv
The created AVS file is :- D:\OUT\4_flv.AVS
The created CMD file is :- D:\OUT\4_flv.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 4_flv
Original Size :- 432x240 with a DAR of 1.800 and SAR of 1.000
Resize to :- 472x262 with Cropping 0,0,432,240, DAR = 1.802, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(16,1.0,236,16,235,Coring=False)
The input Video file is :- D:\VID\5.wmv
The created AVS file is :- D:\OUT\5_wmv.AVS
The created CMD file is :- D:\OUT\5_wmv.CMD eg 1.mpg file is converted 1_mpg.CMD not 1.mpg.CMD, avoids anti malware false +ve.
The Base filename is :- 5_wmv
Original Size :- 720x540 with a DAR of 1.333 and SAR of 1.000
Resize to :- 472x354 with Cropping 0,0,720,540, DAR = 1.333, SAR = 1.000
Resize Relative Cropping :- CropW Relative = 0, CropH Relative = 0
Resize Abs Cropping :- CropRight Abs = 0, CropBottom Abs = 0
AutoLevel :- true
Levels if AUTOLEVEL True :- Levels(1,1.0,255,16,235,Coring=False)
Group Command output (will not show them individually, they look the same).
"D:\TEST\ffmpeg.exe" -i "D:\OUT\1_mpg.AVS" -vcodec libx264 -crf 21.5 -s 472x348 -aspect 1.356 -acodec libvo_aacenc -ab 128k "D:\OUT\1_mpg.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\2_avi.AVS" -vcodec libx264 -crf 21.5 -s 472x266 -aspect 1.774 -acodec libvo_aacenc -ab 128k "D:\OUT\2_avi.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\3_MP4.AVS" -vcodec libx264 -crf 21.5 -s 472x354 -aspect 1.333 -acodec libvo_aacenc -ab 128k "D:\OUT\3_MP4.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\4_flv.AVS" -vcodec libx264 -crf 21.5 -s 472x262 -aspect 1.802 -acodec libvo_aacenc -ab 128k "D:\OUT\4_flv.MKV"
"D:\TEST\ffmpeg.exe" -i "D:\OUT\5_wmv.AVS" -vcodec libx264 -crf 21.5 -s 472x354 -aspect 1.333 -acodec libvo_aacenc -ab 128k "D:\OUT\5_wmv.MKV"
Pause
Probably not optimal (I dont use ffmpeg much) but works pretty good.
Output MKV's all AutoCropped/Resized and AutoLeveled.
Alternatively, could feed the avs files into MeGUI and do them that way, also signals DAR to MeGUI.
(MeGUI AutoEncode Batcher, might assist if you have a lot of avs files to encode).