Selur's Little Message Board
Not working Preview and Avisynth preview - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: Not working Preview and Avisynth preview (/thread-1183.html)



Not working Preview and Avisynth preview - kingcrimsonster - 17.10.2019

Not working Preview and Avisynth preview


RE: Not working Preview and Avisynth preview - Selur - 17.10.2019

The Preview crashes since it opens the Avisynth script and that crashes.
Looking at the Avisynth script
LoadCPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\ffms2.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\masktools2.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\RgTools.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\nnedi3.dll")
Import("C:\Program Files\Hybrid\32bit\avisynthPlugins\LimitedSharpenFaster.avs")
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: C:\1.mkv
#  input color sampling YV12
#  input luminance scale tv
Source = FFVideoSource("C:\1.mkv",cachefile="C:\Windows\Temp\mkv_c320a4c829187fb5c9c9083a7ece468a_853323747_1_0.ffindex",fpsnum=25,colorspace="YV12")
# current resolution: 720x576
SourceFiltered = Source
SourceFiltered = SourceFiltered.AssumeFrameBased().SeparateFields()
# cropping to 708x448
SourceFiltered = SourceFiltered.Crop(2,31,-10,-33)
# current resolution: 708x448  (SourceFiltered)
Source = Source.AssumeFrameBased().SeparateFields()
Source = Source.Crop(2,31,-10,-33)
# current resolution: 708x448  (Source)
# filtering
# color modifications
SourceFiltered = SourceFiltered.Tweak(sat=1.20,dither=true)
SourceFiltered = SourceFiltered.Levels(0,1.00,255,0,255,dither=true)
# sharpening
SourceFiltered = SourceFiltered.LimitedSharpenFaster(Smode=1,strength=160,edgemode=0)
# scaling
Source = Source.BicubicResize(768,456)
# current resolution: 768x456
Source = Source.Weave()
SourceFiltered = SourceFiltered.nnedi3_rpow2(rfactor=2,cshift="GaussResize",fwidth=768,fheight=456)
SourceFiltered = SourceFiltered.Weave()
# stacking horizontal for filter preview
SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec709")
Source = Source.ConvertToRGB32(matrix="Rec709")
StackHorizontal(Source, SourceFiltered)
PreFetch(2)
return last
The problem I see is:
SourceFiltered = SourceFiltered.Crop(2,31,-10,-33)
Yv12 on itself requires mod2 crop values for width and height.
Interlaced Yv12 content requires mod4 crop values.
see: http://avisynth.nl/index.php/Crop#Crop_restrictions
Normally this is not a problem since Hybrid deinterlaced by default and thus it's only restricted to mod2, but since you choose not to deinterlace and clearly didn't know enough about the color sampling you ran into this problem.

I could:
a. write some code next week (busy over the weekend), to catch this warn the User and not show the preview
b. write additional code to do a ConvertToRGB before applying the cropping and convert back afterwards. Normally I would advice against this (due to the impact on the speed), but for preview purposes only it is probably okay.
-> not sure how and if I will implement any of these. For the time being make sure to crop the height with mod4 values and the preview should be fine.

Cu Selur


RE: Not working Preview and Avisynth preview - kingcrimsonster - 17.10.2019

Quote:not sure how and if I will implement any of these. For the time being make sure to crop the height with mod4 values and the preview should be fine.
Now and always I put mod4 values, but preview not working.


RE: Not working Preview and Avisynth preview - Selur - 17.10.2019

You misunderstood what I wrote:
You resize to mod4, but at least the values you used for cropping for the preview the script was from were mod2.
SourceFiltered = SourceFiltered.Crop(2,31,-10,-33)
So your crop values were:
left: 2
top: 62 <- which is mod2
right: 10
bottom: 66 <- which is mod2

For further understanding:
What happens is that the fields get separated by SeparateFields() and each field has half of the height of the original, now they get cropped for which the top and bottom values need to be halved to accommodate the halved height.
Thus each frame get's cropped at the top by 31 and at the bottom by 33, problem is that the field is still YV12 and thus does not allow cropping by odd numbers. Smile

Cu Selur