This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Glithes on the preview and in the destination file
#1
Source file - 3 840 - 2160 px
This file resized to 1920 - 1080 px
When enabled "ColorMatrix" filter on some frames in the "Preview" window appears glitches:

[Image: 6d58e65bdb8b75996455a3d656fae304.jpeg]

Also encoded file is destroyed.

When "ColorMatrix" filter disabled - no glitches.
Reply
#2
Used script is:
ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("C:\PROGRA~1\Hybrid\64bit\Avisynth\AVISYN~1\LSMASHSource.dll")
LoadPlugin("C:\PROGRA~1\Hybrid\64bit\Avisynth\AVISYN~1\ColorMatrix64.dll")
Import("C:\Program Files\Hybrid\64bit\Avisynth\avisynthPlugins\mtmodes.avsi")
# loading source: D:\clips\new73 [2022.09.26]\1\Luisa Sonza - Melhor Sozinha.mp4
# color sampling YV12@8, matrix: bt2020ncl, scantyp: progressive, luminance scale: limited
Source = LWLibavVideoSource("D:\clips\new73 [2022.09.26]\1\Luisa Sonza - Melhor Sozinha.mp4",cache=false,format="YUV420P8", prefer_hw=0,repeat=true)
# current resolution: 3840x2160
SourceFiltered = Source
# color modifications
SourceFiltered = SourceFiltered.ColorMatrix(mode="Rec.2020->Rec.709",clamp=0,interlaced=false,hints=false)
# filtering
# scaling to 1920x1080
Source = Source.PointResize(1920,1080)
SourceFiltered = SourceFiltered.PointResize(1920,1080)
Source = Source.Histogram("levels")
SourceFiltered = SourceFiltered.Histogram("levels")
# stacking horizontal for filter preview
# adjust color to RGB32 (for preview)
SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec2020")
# adjust color to RGB32 (for preview)
Source = Source.ConvertToRGB32(matrix="Rec2020")
StackHorizontal(Source, SourceFiltered)
# setting output fps to 23.976fps
AssumeFPS(24000,1001)
PreFetch(6)
#  output: color sampling RGB32@8, matrix: Rec.709, scantyp: progressive, luminance scale: limited
return last
I tried to reproduce this here using:
ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\LSMASHSource.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\ColorMatrix64.dll")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\mtmodes.avsi")
# loading source: G:\TestClips&Co\files\MPEG-4 H.264\4k\4k_sample_4096x2160.mp4
# color sampling YV12@8, matrix: bt2020ncl, scantyp: progressive, luminance scale: limited
Source = LWLibavVideoSource("G:\TestClips&Co\files\MPEG-4 H.264\4k\4k_sample_4096x2160.mp4",cache=false,format="YUV420P8", prefer_hw=0,repeat=true)
# current resolution: 4096x2160
SourceFiltered = Source
# color modifications
SourceFiltered = SourceFiltered.ColorMatrix(mode="Rec.2020->Rec.709",clamp=3,interlaced=false,hints=false)
# filtering
# scaling to 1920x1080
Source = Source.PointResize(1920,1080)
SourceFiltered = SourceFiltered.PointResize(1920,1080)
Source = Source.Histogram("levels")
SourceFiltered = SourceFiltered.Histogram("levels")
# stacking horizontal for filter preview
# adjust color to RGB32 (for preview)
SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec2020")
# adjust color to RGB32 (for preview)
Source = Source.ConvertToRGB32(matrix="Rec2020")
StackHorizontal(Source, SourceFiltered)
# setting output fps to 25.000fps
AssumeFPS(25,1)
PreFetch(16)
#  output: color sampling RGB32@8, matrix: Rec.709, scantyp: progressive, luminance scale: limited
return last
But here everything is fine.
=> Can't reproduce this. No clue what is causing this.
Can you share a short sample of your source which allows reproducing the issue?

Quote:Glithes on the preview and in the destination file
if the preview is broken it's to be expected that a reencode is too

Cu Selur
Reply
#3
sample
Reply
#4
Thanks, but sadly, I can't reproduce the issue here:
[Image: works-here.png]

Cu Selur
Reply
#5
Selur, please try download full file.
link

This glitch appears only on the entire file. This glitch does not appear on fragments of this file.

This glitch appears starting from frame number 602

[Image: 97c61be9592c57153615d4fe24e0c23b.jpeg]
Reply
#6
Libav software decoder can't handle these. (FFmpegSource2 and LWLibavVideoSource both fail)
Using DGDecNV or libav hardware decoding also shows errors.
This seems this only happens when using Avisynth.
Lowering MT-Threads to 1 seems to somehow fix it, at least partially. Enabling 'Disable MT' does fix it here.
Seems like it's an issue with the colormatrix filter handling the video stream and Avisynth threading.

Hybrid uses the ColorMatrix filter from https://forum.doom9.org/showthread.php?t=173259 which afaik is the newest and first version to support conversions from and to Rec.2020.

=> It's not really a bug of Hybrid.

I would recommend:
a. enable 'Disable MT' for this source, or
b. switch to Vapoursynth

You could also try whether using the 64bit version from https://github.com/sorayuki/ColorMatrix/...s/tag/v2.6 helps.
But reading https://forum.doom9.org/showthread.php?t=175279 there might be issues with it and I would really recommend to not use it in Avisynth for Rec2020->Rec.709 conversions.

Cu Selur
Reply
#7
Quote:enable 'Disable MT' for this source
How much can slow down processing by enabling this option?

Quote:You could also try whether using the 64bit version from https://github.com/sorayuki/ColorMatrix/...s/tag/v2.6 helps

I downloaded from this link "colormatrix.dll". This file is identical to the file "c:\Program Files\Hybrid\32bit\avisynthPlugins\ColorMatrix.dll"

I need to replace "c:\Program Files\Hybrid\64bit\Avisynth\avisynthPlugins\ColorMatrix64.dll" ?
Where can I get this file?
Reply
#8
Forget that, that version is a 32bit dll. Sad
The only 64bit version I know of is the one Hybrid already uses.


Quote:How much can slow down processing by enabling this option?
If ColorMatrix and resizing with point resizer is the only thing, it might even be faster. (I don't really expect any slow down with just these filters, but simply try it.)

Cu Selur
Reply
#9
(28.11.2022, 19:45)Selur Wrote: Lowering MT-Threads to 1 seems to somehow fix it, at least partially. Enabling 'Disable MT' does fix it here.

I would recommend:
a. enable 'Disable MT' for this source,

How much can slow down processing by enabling this option?

If ColorMatrix and resizing with point resizer is the only thing, it might even be faster. (I don't really expect any slow down with just these filters, but simply try it.)

Format : MPEG-4
Format profile : Base Media
File size : 5.83 GiB
Format/Info : Advanced Video Codec
Format profile : Main@L5.1
Format settings : CABAC / 3 Ref Frames
Format settings, Reference frames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 45 min 53 s
Bit rate mode : Variable
Bit rate : 18.0 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels


Resize to 1080p
Filters:
Levels
AutoAdjust
ColorMatrix Rec2020 - Rec709

Encoder NVEncs h264

With 'Disable MT'
Encoding time - 13 hours

With Disable ColorMatrix
Unchecked 'Disable MT'
Set MT-Threads "0"

Encoding time - 2 hours
Reply
#10
Quote:Levels
AutoAdjust
ColorMatrix Rec2020 - Rec709
the more filter you use and if those are more complex speed drop will be increase.

Also, like I wrote:
Quote:.. reading https://forum.doom9.org/showthread.php?t=175279 there might be issues with it and I would really recommend to not use it in Avisynth for Rec2020->Rec.709 conversions.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)