pixop / video-compare

Split screen video comparison tool using FFmpeg and SDL2
GNU General Public License v2.0
889 stars 41 forks source link

Banding in dark scenes #37

Closed gabrielrdrguez closed 1 year ago

gabrielrdrguez commented 1 year ago

So I've noticed a lot of banding in dark scenes that I don't get from mpv or vlc on some files, idk if it's related to the av1 codec or lower bitrate, but for the same file I don't get the same banding in other players

comparison: video-compare: image

mpv: image

vlc: image

sample file:

[SubsPlease] Ijiranaide, Nagatoro-san S2 - 10 (1080p) [4D313AE6]-short-fastflix-4023.zip (github didn't let me upload mkv)

jonfryd commented 1 year ago

Hi @gabrielrdrguez,

Thanks for your report. I'm able to reproduce the issue on my iMac.

video-compare is currently limited to 8 bits per color channel internally which is the reason why we observe visible banding in the darker areas here. I'll have to look into extending the support to higher bit depths at some point when time permits (this has to be done anyway in order to allow support for HDR).

I'm keeping this issue open for now and I'll add a note to the README about this limitation.

gabrielrdrguez commented 1 year ago

Oh I see, I've been transcoding to 10bit to get better quality in gradients but I'll keep that in mind when using video-compare.

Thanks for the info!

jonfryd commented 1 year ago

@gabrielrdrguez,

You might want to check out the 10bpc branch which I pushed a commit to just now. It's very much experimental code and performance is still kind of sluggish, but if you are able to compile the software yourself then you should be able to compare your video without any noticeable banding issues now.

Pass -b when launching video-compare to activate 10 bpc mode.

Cheers!

gabrielrdrguez commented 1 year ago

thanks a lot @jonfryd I'd love to try it myself, but I'm more of a web developer guy, so I'll probably take a while 🤣 Any tips for building it on Windows? It seems the build section of readme refers to linux

jonfryd commented 1 year ago

Sure! You can use Cygwin and MinGW to compile for Windows. It's not super difficult to set up, I think, but your mileage may vary :)

Anyway, I'm planning on releasing a new official version this week when I'm done with the optimization work. The only caveat is that saved image frames are still going to be in 8 bpc for now (we'll migrate to 16-bit PNGs when this stb PR has been finalized and merged).

jonfryd commented 1 year ago

@gabrielrdrguez, a new release is now available with 10 bpc support:

https://github.com/pixop/video-compare/releases/tag/20230306

Let me know if it works for you.

gabrielrdrguez commented 1 year ago

Thanks @jonfryd ! But not really, I got a black screen with -b

jonfryd commented 1 year ago

OK, unfortunately it is very much "hit and miss" if drivers have the required texture pixel format support it seems from a little bit of testing.

-b works OK on my iMac 2017 in Mac OS X (Ventura 13.2.1) and my 7-8 years old Lenovo laptop in Linux. On the very same laptop it displays the dreaded black video feed in Windows 10 (I'll try updating the display driver to see if that fixes the issue). I'm also getting black video on a remote connection for a different Linux machine.

gabrielrdrguez commented 1 year ago

I'm on Windows 11 with latest nvidia driver (531.18) and a RTX 4090 Shout out if you need some testing

jonfryd commented 1 year ago

Thanks! BTW, sweet GFX card you have :)

Maybe I'm doing something wrong, but I have found multiple reports from SDL2 users about the same issue. I'll keep digging and searching...

BTW... What is your bit depth display setting in Windows 11, @gabrielrdrguez?

gabrielrdrguez commented 1 year ago

It's 32bits but 8bpc panel image

That said I've got plugged in a LG C2 that runs on 10bpc

jonfryd commented 1 year ago

Thanks for the screenshot. I wonder if -b works if you change output color depth to 10 bpc (assuming the option is there)?

gabrielrdrguez commented 1 year ago

On my monitor it's not available, on the C2 it's already setted as 10bpc

I've tried now with only the C2 connected and same black screen image

jonfryd commented 1 year ago

OK, at least we tried! I'll look around and get back to you in a day or two...

gabrielrdrguez commented 1 year ago

No worries, call me up if you need anything. Thanks for your time man!

jonfryd commented 1 year ago

@gabrielrdrguez,

Check out: https://github.com/pixop/video-compare/releases/tag/20230308

So it turns out that the SDL2 guys recently added the blit support required for 10 bpc to work properly on some systems. At least -b now works on both my laptop in Win 10 and the remote desktop Linux machine (the black video phenomenon is gone!). Let me know if the new version works for you, as well.

jonfryd commented 1 year ago

@gabrielrdrguez, any luck with the new version?

gabrielrdrguez commented 1 year ago

@gabrielrdrguez, any luck with the new version?

Yo man, sorry for the delay, I had a ton of work this week. Yea it works now, I've still god some banding but now I do believe it's due to the conversion that I'm doing. -b produces much better results with 10bit sources now

Thanks a lot for this release!

jonfryd commented 1 year ago

No worries, man! Happy to hear the new version works on your machine, as well. You can use FFmpeg debanding filters (gradfun or deband in conjunction with pp perhaps) to get rid of the last visible traces of banding.

BTW, I released a new version today which fixes a problem with the zoom function in 20230308. I suggest you upgrade to the new version.

Let's close this one for now. Have a good weekend!