Posts: 329
Threads: 107
Joined: May 2017
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:
Also encoded file is destroyed.
When "ColorMatrix" filter disabled - no glitches.
Posts: 10.598
Threads: 57
Joined: May 2017
27.11.2022, 20:08
(This post was last modified: 27.11.2022, 20:09 by Selur.)
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
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 329
Threads: 107
Joined: May 2017
Posts: 10.598
Threads: 57
Joined: May 2017
Thanks, but sadly, I can't reproduce the issue here:
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 329
Threads: 107
Joined: May 2017
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
Posts: 10.598
Threads: 57
Joined: May 2017
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
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 329
Threads: 107
Joined: May 2017
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?
Posts: 10.598
Threads: 57
Joined: May 2017
Forget that, that version is a 32bit dll.
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
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 329
Threads: 107
Joined: May 2017
(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
Posts: 10.598
Threads: 57
Joined: May 2017
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
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
|