This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Demystifying SD video color spaces
#1
Hey all,

Over the past few months, I've had the chance to work with a significant variety of SD video. One of my biggest issues every time is getting the colors to "look right". When you capture analog video (even the Digital8 format), there is no metadata that specifies the color matrix, primaries, and transfer. As you already know, these differ not only between PAL and NTSC, but also within each format. So if you get one of the properties wrong, colors may look identical, very similar, or completely different, depending on what you got wrong.

What happens when you play a video like this in, say, VLC Player? Since there are no hints present about the color properties, the player will try to guess them based on the remaining properties of the video. That is framerate, video size, interlacing, etc. But if you process the video, say de-interlace with bobbing, or upscale, you will confuse the heuristics of the player and get completely different colors. Also, you definitely want to have the same colors across different players. The only proper way to solve this problem is to take the guesswork out of players by setting explicit hints about each color property.

So, what are the "correct" color properties? According to this post, I gathered that SD video follows the BT.601 standard. In this standard, you have the following properties:

EDIT: Updated with hopefully more correct suggestions as provided by H273 specification.

- BT.601 Primaries
  - NTSC
    - SMPTE 170M (usually), BT.470M (obsolete)
  - PAL
    - BT.470BG
- BT.601 Matrix
  - SMPTE 170M/BT.470BG
- BT.601 Transfer
  - NTSC
    - SMPTE 170M/BT.709 (usually), BT.470M (obsolete)
  - PAL
    - SMPTE 170M/BT.709

Notably, NTSC apparently used BT.470M primaries in the far past, but switched to SMPTE 170M in the recent past. Thankfully, PAL always used BT.470B/G.

This worked for me so far, but I recently hit a problem. I got some PAL videos captured from a Canopus ADVC-100. After I process the videos and compare with the original in VLC Player, I notice that the colors are slightly off. After some experimentation, it seems like I need to use the "gamma 2.8" transfer instead of "BT.470B/G" in order to get the same colors as the raw source. This contradicts the notes above, and also, I have another batch of videos captured over Firewire from a Sony Digital8 Handycam, and those use "BT.470B/G" in VLC Player, not "gamma 2.8". Does anybody know what's the deal here? Which transfer is correct for PAL SD video? How does VLC Player decide to use one or the other?

Thanks!
Reply
#2
No clue, but have you tried other players too, just to be sure this isn't a bug in VLC?

Cu Selur
Reply
#3
So I tried MPlayer and FFPlay and they do not honor the color transfer hint at all, everything gets displayed with the same (to my eye, SMPTE 170M/BT.709) curve.

Here are some sources that suggest gamma 2.8 is used by PAL:
- https://www.tvtechnology.com/opinions/gamma-correction
- https://docs.kdenlive.org/en/glossary/us..._hell.html
- https://en.wikipedia.org/wiki/Gamma_correction

Quote from the first link (https://www.tvtechnology.com/opinions/gamma-correction):

"Gamma (γ) has a value of 2.8 (PAL and SECAM) or 2.2 (NTSC)."

This contradicts the forum post from https://forum.doom9.org/showthread.php?s...ost1681479:

"BT.601 Transfer curve is identical between BT.470 B/G (PAL), BT.470 M (NTSC), SMPTE 170M (NTSC), BT.709"

Indeed, all four of these transfer curves use a gamma of approx. 2.2. But then the first article is incorrect by suggesting PAL uses gamma 2.8?
Reply
#4
Rainbow 
MPlayer didn't really get updates for years. Better use MPV.
FFplayer never really cared about standards.
I would have suggested using MPC-HC or Potplayer.

Quote:Indeed, all four of these transfer curves use a gamma of approx. 2.2. But then the first article is incorrect by suggesting PAL uses gamma 2.8?
Always take into account, that just because something is usually used, doesn't mean it's always used. It's like the general guideline that SD uses bt601, HD uses bt709 and UHD uses rec2020,... not everyone abides by this and usually it's not a big issue if formats are used that support VUI signaling and player respect it. But this isn't a new problem, there are tons of DVDs out there which do not use the usual PAL/NTSC typical colors,...

-> Personally I would always trust my eyes more than some guidelines. Wink

Cu Selur
Reply
#5
Whoops, I actually meant to test mpv not mplayer, I got confused by the naming... Anyway, seems like mpv, MPC-HC and PotPlayer, just like FFPlay, do not care about the transfer function at all, and use the same (to my eye, SMPTE 170M/BT.709) curve. I would trust my eyes but both curves look reasonable in VLC Player, one is just somewhat darker. I will take the majority approach for now and stick with the SMPTE 170/BT.709 curve. I guess case closed? If anybody else has any insights, please do reply.
Reply
#6
Quick update - I have been referred to the H273 specification which defines the format and content of the color hinting discussed above. According to this doc, the BT.601 recommendation has the following properties:

- Rec. ITU-R BT.601-7 525 (NTSC)
  - BT470BG matrix
  - BT.709/SMPTE 170M transfer
  - BT470BG primaries

- Rec. ITU-R BT.601-7 625 (PAL)
  - SMPTE 170M matrix
  - BT.709/SMPTE 170M transfer
  - SMPTE 170M primaries

Interestingly, the document suggests that `bt470bg` transfer is in fact equivalent to `gamma28`, which is not used by the BT.601 recommendation. Maybe VLC Player doesn't support it, so it defaults to BT.709?

The `gamma28` and `bt470bg` transfers are marked as historical, so that further makes me believe that they should not be used (and may not be supported by players, as we saw in the case of mpv, MPC-HC, PotPlayer, etc. above).
Reply
#7
Personally I think player should support even historical color tags, since old files exists too.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)