Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Display Modes
Old 25th January 2025, 18:23   #1  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 2,045
Emulgator's QuadCompare - a script snippet for QC

Code:
#[*# +++++++++ Start of Emulgator's QuadCompare 2025-10-28 +++++++++++++++++++++
#avSource="AviSource"
#avSource="DirectShowSource"
#avSource="FFMS2"
avSource1="BSSource"# You may use different source filters on the same source here just for a sourcefilter comparison...
avSource2="BSSource"# You may use different source filters on the same source here just for a sourcefilter comparison...
avSource3="BSSource"# You may use different source filters on the same source here just for a sourcefilter comparison...
avSource4="BSSource"# You may use different source filters on the same source here just for a sourcefilter comparison...
#---------------------------------------------------------
Comparewidth=1280 # use 1280 for 16:9 sources
#Comparewidth=960 # use 960 for 4:3 sources
#Comparewidth=480 # use 480 for mobile phone sources
Compareheight=720
#Compareheight=240
Comparefps=25.0
ManDecOSD=1
MDOverlayFontSize=Ceil(Compareheight/16)
MDOverlayLineOffset=Ceil(Compareheight/8)
MDOverlayTextColorSource1=$00FFFFFF
MDOverlayTextColorSource2=$00FFFF00
MDOverlayTextColorSource3=$00FFAA00
MDOverlayTextColorSource4=$00FF0000
MDOverlayTextColorOut=$00FF88FF
av1="<pathto>\yourfile1.mp4"
av2="<pathto>\yourfile2.mp4"
av3=av1 # leave this as av1 if you have only 2 files to compare, change only to 3rd file path "<pathto>\yourfile3.mp4" if you have a 3rd file to compare
av4=av2 # leave this as av2 if you have 2 or 3 files to compare, change only to 4th file path "<pathto>\yourfile4.mp4" if you have a 4th file to compare
av1name=String(av1)
av2name=String(av2)
av3name=String(av3)
av4name=String(av4)
avwf1=Apply(avSource1,av1).Assumefps(Comparefps).Waveform() # remarks file1
avfc1=ManDecOSD>0 ? ScriptClip(avwf1, function[avwf1,av1name,MDOverlayFontSize,MDOverlayTextColorSource1] \
{Subtitle(avwf1, String(av1name)+": av1 f "+String(current_frame)+"/"+String(framecount()),size=height/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSource1)}) : av1
avwf2=Apply(avSource2,av2).Assumefps(Comparefps).Waveform() # remarks file2
avfc2=ManDecOSD>0 ? ScriptClip(avwf2, function[avwf2,av2name,MDOverlayFontSize,MDOverlayTextColorSource2] \
{Subtitle(avwf2, String(av2name)+": av2 f "+String(current_frame)+"/"+String(framecount()),size=height/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSource2)}) : av2
avwf3=Apply(avSource3,av3).Assumefps(Comparefps).Waveform() # remarks file3
avfc3=ManDecOSD>0 ? ScriptClip(avwf3, function[avwf3,av3name,MDOverlayFontSize,MDOverlayTextColorSource3] \
{Subtitle(avwf3, String(av3name)+": av3 f "+String(current_frame)+"/"+String(framecount()),size=height/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSource3)}) : av3
avwf4=Apply(avSource4,av4).Assumefps(Comparefps).Waveform() # remarks file4
avfc4=ManDecOSD>0 ? ScriptClip(avwf4, function[avwf4,av4name,MDOverlayFontSize,MDOverlayTextColorSource4] \
{Subtitle(avwf4, String(av4name)+": av4 f "+String(current_frame)+"/"+String(framecount()),size=height/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSource4)}) : av4
stack1=Comparewidth>Compareheight ? \
StackVertical((ConvertToYV12(Lanczos4Resize(Trim(avfc1,0,0),Comparewidth/2,Compareheight/2))),ConvertToYV12(Lanczos4Resize(Trim(avfc2,0,0),Comparewidth/2,Compareheight/2))) : \
StackHorizontal((ConvertToYV12(Lanczos4Resize(Trim(avfc1,0,0),Comparewidth/2,Compareheight/2))),ConvertToYV12(Lanczos4Resize(Trim(avfc2,0,0),Comparewidth/2,Compareheight/2)))
stack2=Comparewidth>Compareheight ? \
StackVertical((ConvertToYV12(Lanczos4Resize(Trim(avfc3,0,0),Comparewidth/2,Compareheight/2))),ConvertToYV12(Lanczos4Resize(Trim(avfc4,0,0),Comparewidth/2,Compareheight/2))) : \
StackHorizontal((ConvertToYV12(Lanczos4Resize(Trim(avfc3,0,0),Comparewidth/2,Compareheight/2))),ConvertToYV12(Lanczos4Resize(Trim(avfc4,0,0),Comparewidth/2,Compareheight/2)))
Comparewidth>Compareheight ? StackHorizontal(stack1,stack2) : StackVertical(stack1,stack2)
ManDecOSD>0 ? ScriptClip(last, function[last,MDOverlayFontSize,MDOverlayLineOffset,MDOverlayTextColorOut] \
{Subtitle(last, "Outframe "+String(current_frame)+"/"+String(framecount()),size=MDOverlayFontSize,align=5,x=Ceil(width*8/16),y=height/2-MDOverlayLineOffset,text_color=MDOverlayTextColorOut)}) : NOP()
return(last)
#*]# ------ End of Emulgator's QuadCompare 2025-10-28 ------------------
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 28th October 2025 at 15:05. Reason: Variable use was inconsistent, font size better matched
Emulgator is offline   Reply With Quote
Old 27th October 2025, 21:02   #2  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 295
I took your script as-is and just entered the two filenames (actually the same file, 720p).

Dialog pops up:

unexpected character: "["
line 25 column 40

???
nji is offline   Reply With Quote
Old 28th October 2025, 11:26   #3  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 2,045
Ah, sorry, I had to reedit my working script variables to match a bigger script and appended a "f", but not everywhere.
Removed the superfluous f here, please redownload.
P.S. And redownload again, today's version framecounter font size should match HD sources better now.
P.P.S. And redownload again, framecounter font size parameterized to match all source resolutions.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 28th October 2025 at 15:07.
Emulgator is offline   Reply With Quote
Old 29th October 2025, 01:18   #4  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 2,045
A more luxurious version

A more luxurious version.
Code:
#[*# +++++++++ Start of Emulgator's QuadCompare 2025-10-29 +++++++++++++++++++++
# Works in later AviSynth, does not work under AviSynth 2.60 (throws [ error at scriptclip [function] entry)
# Dependencies: waveform (tested with 2.0.2)
# Lower-End-Tested with AviSynth 3.7.5 under WinXP32ProSP3 (Intel Core Duo T7600G [up to SSE2, SSE3, SSSE3] 3GB)
# Higher-End-Tested with AviSynth 3.7.5 under Win10U64 (i9-11900K [up to AVX-512] 128GB).
SetMemoryMax(16384)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DirectShowSource", 3)
SetFilterMTMode("LWLibavVideoSource", 3)
SetFilterMTMode("LWLibavAudioSource", 3)
SetFilterMTMode("LSmashVideoSource", 3)
SetFilterMTMode("LSmashAudioSource", 3)
SetFilterMTMode("FFVideoSource", 3)
SetFilterMTMode("FFAudioSource", 3)
SetFilterMTMode("DGSource", 3)
SetFilterMTMode("BSSource", 3)
#avSource="AviSource"
#avSource="DirectShowSource"
#avSource="LSmashSource2" # If XP32-compatibility is required: Holy Wu's L-SMASH-Works-r784-20150316-XP32
#avSource="LibavSource2" # If XP32-compatibility is required: Holy Wu's L-SMASH-Works-r784-20150316-XP32
avSource="FFMS2" # If XP32-compatibility is required:  reino's ffms2-2.18-842-f6098b6-avs-vsp_ffmpeg-6.2-609-238f9de-win32-static-xpmod-sse 2024 05 12
#avSource="BSSource" # No XP, No 32bit, 64bit Only !
avSourceA=avsource # You may use different source filters on the same source here just for a sourcefilter comparison...
avSourceB=avsource # You may use different source filters on the same source here just for a sourcefilter comparison...
avSourceC=avsource # You may use different source filters on the same source here just for a sourcefilter comparison...
avSourceD=avsource # You may use different source filters on the same source here just for a sourcefilter comparison...
#---------------------------------------------------------
autofill=1 # autofill=0 fills all 4 possible panels and reports missing files, autofill= 1 fills only 1x1, 2x1, 3x1, 4x1 consequent panels, any missing file stops further filling
QCOSD=1 # 1 activates OSD, 0 deactivates OSD
AudioMerge=0 # 1 activates merge before Audio playback, resource hungry because of resampling ! 0 delivers Audioplayback from clip A only
UHDScreenfactor=1.5 # Size overruler, 1 for FHD displays, 1.5..2  for UHD displays
AR=1.777 # 64/27 as 2.37, 16:9 as 1.777, 4:3 as 1.333... Any value above and including 1.000 will trigger 1x1, 2x1, 3x1, 4x1 or 2x2 preview display in comparewidth. For any "normal" video shot in landscape mode.
#AR=0.5625 # 9/16 as 0.5625...Any value below 1.000 will trigger 1x1, 2x1, 3x1, 4x1 preview display in compareheight, horiontally side-by side. For any "upright" video shot in portrait mode, from mobile phones etc. 
Comparewidth=1280 # Only valid for the AR-triggered 2x2 landscape preview window, heights follow AR. Ignored in portrait mode.
Compareheight=720 # Only valid for the AR-triggered 4x1 portrait preview window, widths follow AR. Ignored in landscape mode.
Comparefps=25.0 #  Match to desired master.
Comparewidth=Round(UHDScreenfactor*Comparewidth)
Compareheight=Round(UHDScreenfactor*Compareheight)
MDOverlayFontSize=Ceil(Min(Comparewidth,Compareheight)/16)
MDOverlayLineOffset=Ceil(Min(Comparewidth,Compareheight)/8)
MDOverlayTextColorSourceA=$00FFFFFF
MDOverlayTextColorSourceB=$00FFFF00
MDOverlayTextColorSourceC=$00FFAA00
MDOverlayTextColorSourceD=$00FF0000
MDOverlayTextColorOut=$00FF88FF
MDOverlayTextColorOut=$00FF88FF
avA="<pathto>\yourfileA.mp4"
avB="<pathto>\yourfileB.mp4"
avC="<pathto>\yourfileC.mp4"
avD="<pathto>\yourfileD.mp4"
avAname=String(avA)
avBname=String(avB)
avCname=String(avC)
avDname=String(avD)
avwfA=Exist(avA) ? avSource=="FFMS2" ? \
Apply(avSourceA,avA,-1,-1).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Apply(avSourceA,avA).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Assert(false, "! NO SUCH AV FILE -> " + avAname + "<- NO SUCH AV FILE !")
avfcA=QCOSD>0 ? ScriptClip(avwfA, function[avwfA,avAname,MDOverlayFontSize,MDOverlayTextColorSourceA] \
{Subtitle(avwfA, String(avAname)+" : file A f "+String(current_frame)+"/"+String(framecount()),size=Min(width,height)/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSourceA)}) : avwfA
avwfB=Exist(avB) ? avSource=="FFMS2" ? \ 
Apply(avSourceB,avB,-1,-1).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Apply(avSourceB,avB).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Subtitle(Blankclip(avwfA),"Missing file B",size=2*MDOverlayFontSize,align=5,text_color=$FFFFFF)
avfcB=QCOSD>0 ? ScriptClip(avwfB, function[avwfB,avBname,MDOverlayFontSize,MDOverlayTextColorSourceB] \
{Subtitle(avwfB, String(avBname)+" : file B f "+String(current_frame)+"/"+String(framecount()),size=Min(width,height)/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSourceB)}) : avwfB
avwfC=Exist(avC) ? avSource=="FFMS2" ? \
Apply(avSourceC,avC,-1,-1).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Apply(avSourceC,avC).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Subtitle(Blankclip(avwfA),"Missing file C",size=2*MDOverlayFontSize,align=5,text_color=$FFFFFF)
avfcC=QCOSD>0 ? ScriptClip(avwfC, function[avwfC,avCname,MDOverlayFontSize,MDOverlayTextColorSourceC] \
{Subtitle(avwfC, String(avCname)+" : file C f "+String(current_frame)+"/"+String(framecount()),size=Min(width,height)/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSourceC)}) : avwfC
avwfD=Exist(avD) ? avSource=="FFMS2" ? \
Apply(avSourceD,avD,-1,-1).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Apply(avSourceD,avD).Assumefps(Comparefps).ConvertToYUV444().ConvertBits(8).Waveform() : \
Subtitle(Blankclip(avwfA),"Missing file D",size=2*MDOverlayFontSize,align=5,text_color=$FFFFFF)
avfcD=QCOSD>0 ? ScriptClip(avwfD, function[avwfD,avDname,MDOverlayFontSize,MDOverlayTextColorSourceD] \
{Subtitle(avwfD, String(avDname)+" : file D f "+String(current_frame)+"/"+String(framecount()),size=Min(width,height)/16,align=9,x=Floor(width*31/32),y=height/16,text_color=MDOverlayTextColorSourceD)}) : avwfD
#For temporally matching of version previews please modify/extend the Trim() sections.
insertApos1=100
insertApos1len=0
trimA=Trim(avfcA,0,insertApos1)++Subtitle(Blankclip(avfcA,insertApos1len),"Missing \nframe",lsp=10,size=2*MDOverlayFontSize,align=5)++Trim(avfcA,insertApos1+1,0)
insertBpos1=105
insertBpos1len=0
trimB=Lanczos4Resize(Trim(avfcB,0,insertBpos1)++Subtitle(Blankclip(avfcB,insertBpos1len),"Missing \nframe",lsp=10,size=2*MDOverlayFontSize,align=5)++Trim(avfcB,insertBpos1+1,0),Comparewidth/2,Compareheight/2)
insertCpos1=110
insertCpos1len=0
trimC=Lanczos4Resize(Trim(avfcC,0,insertCpos1)++Subtitle(Blankclip(avfcC,insertCpos1len),"Missing \nframe",lsp=10,size=2*MDOverlayFontSize,align=5)++Trim(avfcC,insertCpos1+1,0),Comparewidth/2,Compareheight/2)
insertDpos1=120
insertDpos1len=0
trimD=Lanczos4Resize(Trim(avfcD,0,insertDpos1)++Subtitle(Blankclip(avfcD,insertDpos1len),"Missing \nframe",lsp=10,size=2*MDOverlayFontSize,align=5)++Trim(avfcD,insertDpos1+1,0),Comparewidth/2,Compareheight/2)
restrimA=AR>1 ? Lanczos4Resize(trimA,Round(Comparewidth/2),Round(Comparewidth/(2*AR))) : Lanczos4Resize(trimA,Round(Compareheight*AR),Round(Compareheight))
restrimB=AR>1 ? Lanczos4Resize(trimB,Round(Comparewidth/2),Round(Comparewidth/(2*AR))) : Lanczos4Resize(trimB,Round(Compareheight*AR),Round(Compareheight))
restrimC=AR>1 ? Lanczos4Resize(trimC,Round(Comparewidth/2),Round(Comparewidth/(2*AR))) : Lanczos4Resize(trimC,Round(Compareheight*AR),Round(Compareheight))
restrimD=AR>1 ? Lanczos4Resize(trimD,Round(Comparewidth/2),Round(Comparewidth/(2*AR))) : Lanczos4Resize(trimD,Round(Compareheight*AR),Round(Compareheight))
restrimAB=StackHorizontal(restrimA,restrimB)
restrimCD=StackHorizontal(restrimC,restrimD)
autofill==0 && AR>=1 ? StackVertical(restrimAB,restrimCD) : autofill==0 && AR<1 ? StackHorizontal(restrimAB,restrimCD) : \
Exist(avA) && Exist(avB) && Exist(avC) && Exist(avD) && AR>1 ? StackVertical(StackHorizontal(restrimA,restrimB), StackHorizontal(restrimC,restrimD)) : \
Exist(avA) && Exist(avB) && Exist(avC) && Exist(avD) && AR<=1 ? StackHorizontal(restrimA,restrimB,restrimC,restrimD) : \
Exist(avA) && Exist(avB) && Exist(avC) ? StackHorizontal(restrimA,restrimB,restrimC) : Exist(avA) && Exist(avB) ? StackHorizontal(restrimA,restrimB) : restrimA
AudioMerge==1 ? MergeChannels(ResampleAudio(last,48000),ResampleAudio(restrimB,48000),ResampleAudio(restrimC,48000),ResampleAudio(restrimD,48000)) : NOP()
QCOSD>0 ? ScriptClip(last, function[last,MDOverlayFontSize,MDOverlayLineOffset,MDOverlayTextColorOut] \
{Subtitle(last, "Outframe "+String(current_frame)+"/"+String(framecount()),size=MDOverlayFontSize,align=5,x=Ceil(width*8/16),y=height/2+MDOverlayLineOffset,text_color=MDOverlayTextColorOut)}) : NOP()
#Prefetch(threads=7, frames=8)
return(last)
#*]# ------ End of Emulgator's QuadCompare 2025-10-29 ------------------
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 29th October 2025 at 14:44. Reason: Moar & greedier features
Emulgator is offline   Reply With Quote
Reply

Tags
compare, control, framedrops, framedups, quality

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.