Log in

View Full Version : Convert: Input ChromaPlacement only available with 4:2:0 or 4:2:2 sources.


Selur
18th June 2022, 15:59
I'm on Windows 11, using Avisynth+ 64bit version 3.7.2 (r3661, 37, x96_64)
and the following script:

ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\LSMASHSource.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\RgTools.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\masktools2.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\mvtools2.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\nnedi3.dll")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\mtmodes.avsi")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\QTGMC.avsi")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\Zs_RF_Shared.avsi")
# loading source: C:\Users\Selur\Desktop\Eye-of-Satan-NTSC-VHS-sample.mov
# color sampling YV411@8, matrix: bt601, scantyp: bottom field first, luminance scale: limited
LWLibavVideoSource("C:\Users\Selur\Desktop\EYE-OF~1.MOV",cache=false,format="YUV411P8", prefer_hw=0)
# current resolution: 720x480
# deinterlacing
ConvertToYV12(interlaced=true)
AssumeBFF()
QTGMC(Preset="Fast", ediThreads=2)
SelectEven()
# filtering
# adjust color to RGB32 (color matrix: Rec601)
ConvertToRGB32(matrix="Rec601")
# setting output fps to 29.970fps
AssumeFPS(30000,1001)
PreFetch(16)
# output: color sampling RGB32@8, matrix: bt601, scantyp: progressive, luminance scale: limited
return last

but this gives me:
Convert: Input ChromaPlacement only available with 4:2:0 or 4:2:2 sources. (in the 'ConvertToYV12(interlaced=true)'-line)
as a workaround I could use:
LWLibavVideoSource("C:\Users\Selur\Desktop\EYE-OF~1.MOV",cache=false,format="YUV422P8", prefer_hw=0)
and remove the 'ConvertToYV12(interlaced=true)', but the question is: Why does "ConvertToYV12(interlaced=true)" report the mentioned error?
Am I missing something or is this a bug?

Cu Selur

DTL
18th June 2022, 16:09
The internal test

BlankClip(pixel_type="YV411")
Info()
ConvertToYV12(interlaced=true)


is working.

Can you place Info() before ConvertToYV12(interlaced=true) to check if LWLibavVideoSource() really return YV411 format ?

Or may be better

return Info()


To skip passing unknown data to ConvertToYV12()

Though

BlankClip(pixel_type="YV411")
Info()
ConvertToYV12(ChromaInPlacement="DV",interlaced=true)

Throws error about 4:2:0 only. In the wiki 4:1:1 and Convert should be valid for 4:1:1 - http://avisynth.nl/index.php/Convert ? .
May be 4:1:1 is very rare to use and something finally broken after adding frame properties and something around it. May be LWLibavVideoSource() sets some frame props that confuses ConverttoYV12() ?

Selur
18th June 2022, 16:14
Better to report to AVS+ development to ..
-> done.

DTL
18th June 2022, 16:48
Also try to view frame properties after
LWLibavVideoSource()

with
propShow()

The BlankClip(pixel_type="YV411") only sets _ColorRange and _Matrix properties. May be that LWLibavVideoSource() filter sets _ChromaLocation and it cause error in ConvertToYV12() ?

Yes - the bug looks like with 411 and _ChromaLocation property is set. And most of colour Convert* functions (except for ConvertToY() at least) fail now.

As a current workaround try to put

propDelete("_ChromaLocation")

before ConvertToYV12(interlaced=true)

Selur
18th June 2022, 17:13
LWLibavVideoSource("C:\Users\Selur\Desktop\EYE-OF~1.MOV",cache=false,format="YUV411P8", prefer_hw=0)
propShow()
gives me:

Convert: Input ChromaPlacement only available with 4:2:0 or 4:2:2 sources.
Trying alternative RGB32 conversion
Attempt failed!

LWLibavVideoSource("C:\Users\Selur\Desktop\EYE-OF~1.MOV",cache=false,format="YUV411P8", prefer_hw=0)
propDelete("_ChromaLocation")
propShow()
shows:

Number of keys = 11
_DurationDen = 2997
_DurationNum = 100
_EncoderFrameBottom = 0
_EncoderFrameTop = 0
_FieldBased = 1
_Matrix = 6 = 170m
_Pic_type = "I"
_Primaries = 6
_SARDen = 9
_SARNum = 8
_Transfer = 1

when using propDelete("_ChromaLocation") before "ConvertToYV12(interlaced=true)" it also works.

Cu Selur

DTL
18th June 2022, 17:27
"when using propDelete("_ChromaLocation") before "ConvertToYV12(interlaced=true)" it also works."

So it may be workaround until next fixed build of 3.7.2+ .

Selur
18th June 2022, 17:34
yup, thanks for the help. :)

FranceBB
18th June 2022, 22:14
Ever since frame properties got added, things got a bit cranky.
This error first came out in November 2021, but it was related to 4:2:2 MPEG-2 sources with indexers reporting top left instead of left.
The reason was that at the very beginning we thought chroma location made sense only for 4:2:0, however we found out that there was chroma placement being reported for 4:2:2 sources too as either left or top_left.
After investigating a bit, we realized that in 4:2:2 both left and top_left refer to the same thing, however due to the fact that different people wrote different decoders/indexers, all 4:2:2 sources encoded in H.264 reported left and all 4:2:2 sources encoded in MPEG-2 reported top_left, even though the chroma placement was actually the same 'cause both slots are filled on the left in 4:2:2.
Anyway, long story short, we all agreed to allow chroma placement handling in 4:2:2 as well and we put aliases for left and top_left, which solved the issue... but we forgot 4:1:1. :scared:

I'm surprised no one reported it 'till now but I'm glad you did. I'm sure Ferenc will address this too like he did for 4:2:2.

p.s in my production servers, even though I'm using the very latest version of Avisynth, I've added propclearall() after indexing in all my scripts to play safe 'till frame properties are gonna be something properly supported by all filters/plugins, internal and external and I strongly suggest anyone using programs that write automated scripts etc to do the same.