jaskie / Server

This fork of CasparCG Server contains enhancements used in broadcast play-out system used in TVP.
http://playoutautomation.tvp.pl
GNU General Public License v3.0
20 stars 4 forks source link

Deinterlacing and upscaling - very poor quality #15

Closed jan-adam closed 10 months ago

jan-adam commented 10 months ago

I noticed a problem while using CasparCG fork (v2.0.6.TVP 8.6a) provided with TVPlay. This problem does not occur with latest CasparCG release (v2.3.3 LTS Stable).

Channel video mode: 1080p50 Media format: PAL SD (576i50)

I am attaching an example PAL SD material with text and horizontal lines (exported from Davinci Resolve), which perfectly shows the essence of the problem.

https://github.com/jaskie/Server/assets/82673920/937df89f-bf67-4bfb-9d60-ca1767c62141

Below are various configurations and three close-ups.

  1. Sample file played in video players (VLC, Windows Media Player, Movies & TV). This shows that the sample file is fine. The "deinterlacing and scaling" result is correct. Even in the above embedded GitHub player it is correct.

1 fragment

  1. Sample file played in TVPlay with CasparCG v2.3.3 LTS Stable. The result is also correct. Of course, the result is slightly different due to different deinterlacing methods (as we know, it cannot be done perfectly).

2 fragment

  1. Sample file played in TVPlay with CasparCG fork (v2.0.6.TVP 8.6a). The result is just bad! Very bad! When playing color video materials, the problem also occurs of course, all high-contrast transitions look very bad.

3 fragment

Interestingly, when the channel video mode is set to 1080i50, the problem does not occur. And I'm surprised that the more difficult conversion (576i50 -> 1080i50) is performed correctly by CasparCG TVP's fork, while the easier conversion (576i50 -> 1080p50, easier because no interlaced output) causes terrible artifacts. These artifacts only occur when using the TVP fork, latest official version of CasparCG does everything correctly.

jaskie commented 10 months ago

Build provided in https://github.com/jaskie/Server/releases/tag/v8.8 Indeed, too many optimizations leads to errors 😉 Now it should be even better (smooth movement), because of using bwdif ffmpeg deinterlace filter, which used to be way better than GPU scaling. Let me know what's your opinion on it, please.

jan-adam commented 10 months ago

Thank you for your quick response and fix.

I tested 576i50, 1080i50 and 1080p50 videos.

PAL SD video looks much better now. It looks just the way it should look, without interlacing artifacts.

But unfortunately, regression appeared: now there is no deinterlacing for 1080i50 videos. This is a serious problem.

jaskie commented 10 months ago

Fixed, binaries under the same release

jan-adam commented 10 months ago

Looks like it's okay now.

yadif or bwdif - it doesn't matter to me. What is important is that it correctly transfers the smoothness of interlaced videos (so 50i -> 50p, never 25p). And it works much, much better than simple field scaling.

Thank you very much for developing this software. In my opinion, TVPlay is the best playout automation software for small broadcasters. Simple, yet powerful.

It's good that now deinterlacing works as well as in the latest version of CasparCG.

If I may, a short digression.

It is funny and at the same time surprising that better results can be achieved with simple, consumer grade equipment and open software (CasparCG, ffmpeg, yadif) than with expensive professional equipment. Well, I noticed that TVP uses probably simple field scaling to change the resolution from 576i50 to 1080i50 on all its main channels! There are a lot of artifacts similar to those in this issue, and in addition the image constantly moves up (first field) and then down (second field) by one pixel. This is present on all old materials. I haven't noticed this problem with other broadcasters (like all channels from Polsat company). It's amazing that consumer grade hardware and regular graphics cards can handle interlace scaling better than professional TV...