CrendKing / avisynth_filter

DirectShow filters that put AviSynth and VapourSynth into video playing
MIT License
107 stars 8 forks source link

Green screen in MPC-BE player with 10bit video #65

Closed BlackMickey closed 2 years ago

BlackMickey commented 2 years ago

Environment

Describe the bug

When using Vapoursynth filter in MPC-BE to play 10Bit video, MPC-BE shows green screen.

To Reproduce

  1. install python 3.9.10
  2. install VapourSynth R57
  3. install Avisynth filter & VapourSynth Filter v1.3.1
  4. [MPC-BE] add filter -> Vapoursynth Filter -> Prefer
  5. [Vapoursynth Filter] Enable remote control
  6. start svp4 pro
  7. play 10bit video

MPC-BE with Avisynth filter MPC-BE+Avisynth

MPC-BE with Vapoursynth filter MPC-BE+Vapoursynth

mpv with Vapoursynth mpv+Vapoursynth

CrendKing commented 2 years ago

I tried on the same file you show here and have no problem:

Clipboard 1

From your log, I can understand what the problem is. But I can't reproduce it.

If you are using an older version of SVP, please update. The problem might be already solved in an SVP update.

Basically, due to this old issue, AVSF expects 10-bit video to be either in standard P016 form, or the P010 form where zeroes are at LSB. SVP might be output the MSB form via VapourSynth's resize filter. The easy fix would be resize the video to P016.

BlackMickey commented 2 years ago

I can reproduce it. The problem should be with SmoothFps.

smooth = core.svp2.SmoothFps(input_m.resize.Point(format=vs.YUV420P16),...) YUV420P16

smooth = core.svp2.SmoothFps(input_m.resize.Point(format=vs.YUV420P10),...) YUV420P10

CrendKing commented 2 years ago

Thanks. So you can confirm the problem is the resize with YUV420P10, right? SVP should generate script with YUV420P016 in it, not P010.

Here is the extract of my SVP's generate.js:

res += bl+'input_um = clip.resize.'+(media.is420 ? 'Point':'Bicubic')+'(format=vs.YUV420'+(media.p10?'P16':'P8')+',dither_type="'+dither+'")'+br;

Check yours. If it is not like this, update your SVP.

PhantomGamers commented 2 years ago

I'm having the same issue, but the SVP 4/script/generate.js for me has:

res += bl+'input_um = clip.resize.'+(media.is420 ? 'Point':'Bicubic')+'(format=vs.YUV420'+(media.p10?'P10':'P8')+',dither_type="'+dither+'")'+br;

my SVP is showing as fully updated on my end hm

EDIT: Replacing the line with yours seems to have fixed the issue though

CrendKing commented 2 years ago

Gotcha. Here is what I'm gonna do.

I will add the P010 conversion code so that regardless if the input is P010 or P016, you will not get green screen. This conversion logic itself will incur some performance penalty, since it will have to convert every pixel.

Some cases after the change:

  1. Source video is P010 -> SVP converts to P010 -> VPSF does the conversion. In this flow, the first arrow should be basically no-op, and the second arrow does the work.
  2. Source video is P010 -> SVP converts to P016 -> VPSF does NOT do conversion. In this flow, only the first arrow does work.
  3. Source video is P016 -> SVP converts to P010 -> VPSF does the conversion, there will be double conversion.
  4. Source video is P016 -> SVP converts to P016 -> VPSF does NOT do conversion. In this flow, there will be no work needed.

So only case 3 is problematic. If you don't have P016 video, you are fine.

CrendKing commented 2 years ago

Try the snapshot build from https://github.com/CrendKing/avisynth_filter/actions/runs/1967569617 see if it works.

BlackMickey commented 2 years ago

I'm having the same issue, but the SVP 4/script/generate.js for me has:

res += bl+'input_um = clip.resize.'+(media.is420 ? 'Point':'Bicubic')+'(format=vs.YUV420'+(media.p10?'P10':'P8')+',dither_type="'+dither+'")'+br;

my SVP is showing as fully updated on my end hm

EDIT: Replacing the line with yours seems to have fixed the issue though

The generate.js is modified as follows.

res += bl+'input_um = clip.resize.'+(media.is420 ? 'Point':'Bicubic')+'(format=vs.YUV420'+(media.p10? global.player=4? 'P16':'P10':'P8')+',dither_type="'+dither+'")'+br;

Playing 10bit video in mpv won't get a green screen.