mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.56k stars 2.92k forks source link

opengl-hq distorts colors for some video files #3517

Closed avi9526 closed 7 years ago

avi9526 commented 8 years ago

mpv version and platform

ArchLinux, problem persist with repository version:

mpv 0.20.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects built on Sat Aug 27 12:41:39 CEST 2016 ffmpeg library versions: libavutil 55.28.100 libavcodec 57.48.101 libavformat 57.41.100 libswscale 4.1.100 libavfilter 6.47.100 libswresample 2.1.100 ffmpeg version: 3.1.3

and with aur version https://aur.archlinux.org/packages/mpv-git/

mpv git-343f5ca (C) 2000-2016 mpv/MPlayer/mplayer2 projects built on Mon Sep 12 20:08:33 EEST 2016 ffmpeg library versions: libavutil 55.28.100 libavcodec 57.48.101 libavformat 57.41.100 libswscale 4.1.100 libavfilter 6.47.100 libswresample 2.1.100 ffmpeg version: 3.1.3

Reproduction steps

Open this file https://0x0.st/SSy.mp4 (ask if upload to other storage) with console command: mpv "Overwatch 09.10.2016 - 12.56.54.09.DVR.mp4" or mpv --profile=opengl-hq "Overwatch 09.10.2016 - 12.56.54.09.DVR.mp4" or use smplayer with opengl(-hq) as output driver

Actual behavior and Expected behavior

Compare this two images, left (bad colors) is with --profile=opengl-hq, right (good colors) is with --vo=vdpau http://imgur.com/IBvg2hb

Log files

http://pastebin.com/raw/w5MbHpAJ

haasn commented 8 years ago

Do you have a reference image for comparison? Or how do you know the one on the left is wrong?

avi9526 commented 8 years ago

1) I have played that game, it look more like right one 2) Open using: vlc, mplayer, windows player, basically any other player that I have and is not mpv with opengl 3) When I was last time checking my eyes I was not colourblind

qmega commented 8 years ago

The video is tagged with BT.601 but should be BT.709 (or something close). Using --vf=format=colormatrix=bt.709:primaries=bt.709 makes it look right. (I've also played the game and the BT.709 result is definitely more accurate.)

haasn commented 8 years ago

Can confirm what @qmega said, looking at the file it seems to have some pretty messed up tags.

Color range                              : Limited
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.470 System M
Matrix coefficients                      : BT.601

If this is the output of a screen capture than it should most likely be tagged as BT.709/sRGB for the colorspace, and the matrix coefficients should be set to whatever the encoder used while encoding.

1) I have played that game, it look more like right one

As far as we know, all this indicates is that the file might be broken or mistagged. (Which indeed seems to be the case here)

2) Open using: vlc, mplayer, windows player, basically any other player that I have and is not mpv with opengl 3) When I was last time checking my eyes I was not colourblind

Neither of these are valid points

sda89ha9 commented 8 years ago

--vf=format=primaries=bt.709, result is comparable to mpc-hc

haasn commented 8 years ago

@wm4 Btw, shouldn't vo_vdpau also use the BT.601 matrix if tagged like that? vo_vdpau uses BT.709 always on my end on this clip, that seems like a bug to me.

Also, it seems like there was a bug where the use of BT.470 System M transfer characteristics + BT.601 NTSC primaries caused the colorspace to actually be interpreted as BT.470 M instead, which made this issue worse. (A correctly tagged file would still have played correctly, but the fallback guessing logic to deal with unknown or broken colorimetry contained a bug)

I've never before seen such a mistagged file, so it never got triggered before.

avi9526 commented 8 years ago

Neither of these are valid points

sorry, I am getting salty after playing that game

It looks like you are right, the problem is with original software, which seems to be known issue for 2 years now https://forums.geforce.com/default/topic/789194/shadowplay-recording-the-wrong-colours/?offset=1

ghost commented 8 years ago

So does f7471b7ff48540a4184fb095e23b2c50d9720375 fix this?

haasn commented 8 years ago

@wm4 It should partially solve it, because the intended logic was to explicitly ignore color adaptation of BT.601 by default, to avoid bugs like these where people complain about mistagged files, that logic was just bugged.

The colormatrix will still be different, but the difference between BT.601 and BT.709 matrix coefficients is small enough to the point where people generally probably don't notice the difference.