Log in

View Full Version : Problem with the colors of my video


SuperLumberjack
31st August 2016, 21:05
Hello :)

I have a problem with Dailymotion (same problem on YouTube).

I encoded a video with this caracteristics :

General
Complete name : F:\SR1INT_E.PSS
Format : MPEG-PS
File size : 126 MiB
Duration : 3 min
Overall bit rate mode : Variable
Overall bit rate : 5 019 kb/s

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=15
Duration : 3 min
Bit rate mode : Variable
Bit rate : 3 383 kb/s
Maximum bit rate : 6 656 kb/s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate : 29.970 (30000/1001) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.367
Time code of first frame : 00:00:00:00
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 85.1 MiB (67%)
Color primaries : BT.601 PAL
Transfer characteristics : BT.470 System B, BT.470 System G
Matrix coefficients : BT.601

Audio
ID : 189 (0xBD)
Format : PCM
Muxing mode : PS2
Duration : 3 min
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Stream size : 38.6 MiB (31%)


After I used this AviSynth script to upscale the video in 1080p :

AviSource("F:\SR1INT_E.avi")
Spline16Resize(1440, 1080)
ConvertToYV24()
nnedi3_rpow2(rfactor=2, nsize=0, nns=4, qual=1, etype=0, pscrn=2, threads=0, opt=0, fapprox=0)
BicubicResize(b=0, c=0.5, 1440, 1080)

I exported the video in AVI with codec "UtVideo YUV420 BT.709 VCM", so it's in Rec.709.

Then, I encoded the video with Handbrake.

Here is the MediaInfo :

General
Unique ID : 162946864138085670725435665034302896727 (0x7A966CABF348AEDA7655371794A2BA57)
Complete name : H:\Soul Reaver.mkv
Format : Matroska
Format version : Version 2
File size : 526 MiB
Duration : 3 min
Overall bit rate mode : Variable
Overall bit rate : 20.9 Mb/s
Encoded date : UTC 2016-08-31T08:50:29Z
Writing application : HandBrake 0.10.5 2016021100
Writing library : Lavf55.12.0 / Lavf55.12.0

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5
Format settings, CABAC : Yes
Format settings, ReFrames : 16 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 3 min
Nominal bit rate : 20.0 Mb/s
Width : 1 440 pixels
Height : 1 080 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.429
Writing library : x264 core 142 r2479 dd79a61
Encoding settings : cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=20000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio
ID : 2
Format : FLAC
Format/Info : Free Lossless Audio Codec
Codec ID : A_FLAC
Duration : 3 min
Bit rate mode : Variable
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Title : Stereo
Default : Yes
Forced : No


The picture gives this :

http://image.noelshack.com/fichiers/2016/35/1472673632-original-picture.png

And now on Dailymotion (see the red) :

http://image.noelshack.com/fichiers/2016/35/1472673679-dailymotion-differents-colors.png

What is the problem do you think please ? :confused:

As I said, it's the same on YouTube.

So, it's a common problem on the both plateforms. I thought it's the color matrix. And you ? :p

Thanks for your answer ;)

sneaker_ger
31st August 2016, 21:14
I exported the video in AVI with codec "UtVideo YUV420 BT.709 VCM", so it's in Rec.709.
Why? Did the software you used to export convert the colors?

If not you need to convert them in your script using e.g. ColorMatrix(mode="Rec.601->Rec.709") (http://forum.doom9.org/showthread.php?p=1763578#post1763578). In the end it comes down to the web service and browsers. It may be difficult to impossible to get it 100% correct all the time.

SuperLumberjack
31st August 2016, 21:19
Hello,

I use UtVideo codec because it is lossless. And I already had problem with Handbrake, which recognized the color format as Rec.601.

So I do all in the same time ;)

SuperLumberjack
31st August 2016, 21:37
When I use :

ColorMatrix(mode="Rec.601->Rec.709")

I have the same picture that on Dailymotion and YouTube.

But the original must be like that I think, as read by Media Player Classic (which recognizes BT.601) :

http://image.noelshack.com/fichiers/2016/35/1472675793-media-player-classic.png

raffriff42
31st August 2016, 21:51
I used this AviSynth script to upscale the video in 1080p :

AviSource("F:\SR1INT_E.avi")
Spline16Resize(1440, 1080)
ConvertToYV24()
[...]

I exported the video in AVI with codec "UtVideo YUV420 BT.709 VCM", so it's in Rec.709.Not necessarily; only if the codec performs the RGB-toYUV conversion internally. If the codec sees a YUV source, the colors are not "converted" to Rec709 (the colors may be resampled, but not "re-matrixed") but the video is labeled (maybe falsely) as Rec709.

(EDIT #2) It's better to let UTVideo perform the conversion by feeding it RGB24/32, OR control the conversion from RGB to YUV yourself and specify the matrix. Also, (less importantly) don't pass YV24 to a YV12 codec, an extra color format conversion is done that way. Try this:AviSource("F:\SR1INT_E.avi")
## (assuming we have RGB at this point)
Spline16Resize(1440, 1080)
ConvertToYV12(matrix="Rec709") ## (or, omit this line)
[...]

sneaker_ger
31st August 2016, 21:54
Oh, I didn't notice. He says his source is "SR1INT_E.PSS" with MPEG2 YUV but then he uses AviSource() to open "SR1INT_E.avi". There's an unexplained step in-between.

SuperLumberjack
31st August 2016, 22:04
Not necessarily; only if the codec performs the RGB-toYUV conversion internally. If the codec sees YV12, YV24 or YUY2, the colors are not "converted" to Rec709 - they are passed though as is and labeled (maybe falsely) as Rec709.

It's better to control the conversion from RGB to YUV yourself and specify the matrix. Also, (less importantly) don't pass YV24 to a YV12 codec, an extra color format conversion is done that way. Try this:AviSource("F:\SR1INT_E.avi")
## (assuming we have RGB at this point)
Spline16Resize(1440, 1080)
ConvertToYV12(matrix="Rec709")
[...]

OK. Thanks ! :) Is used "ConvertToYV24", because on an other video, with "ConvertToYV12" it was very blurry. So I wanted to convert to YV12 in the end.

The problem is that it's very old videos, so the format isn't always clear. I must verify a lot with my eyes :p

I know it's not very logical to convert to YV24, but the fact is that in YV12 at the beginning, sometines my videos looks like s***... :D

The original color format is not always recognizes I think. It's very complicated with all these color format things... !

Oh, I didn't notice. He says his source is "SR1INT_E.PSS" with MPEG2 YUV but then he uses AviSource() to open "SR1INT_E.avi". There's an unexplained step in-between.

Yes, sorry ! :) I converted the PPS file to an AVI file with Lagarith codec before ;)

SuperLumberjack
31st August 2016, 22:58
I think you both have right ! All my videos must be convert to Rec.709 ;)

This old videos !%*$ ! :p

The oranged reds are a sign :)

Edit : Finally I'm not sure !


For information, these videos are from differents games. It's a saga called "Legacy of Kain" :p

And here is a capture from a video (upscaled to 1080p) of the last game :

http://image.noelshack.com/fichiers/2016/35/1472685999-image-rec-601.png

It's from a BINK video (the PC version), but the colors are identical to the PSS video (PlayStation 2 version).

After convertion of Rec.601 to Rec.709, I get this :

http://image.noelshack.com/fichiers/2016/35/1472686026-image-rec-709.png

Maybe it looks natural to your eyes, but it's completely different from the colors in the game :

http://image.noelshack.com/fichiers/2016/35/1472686048-legacy-ok-kain-defiance.jpg

So I don't think I must convert Rec.601 to Rec.709. But the problem is that Dailymotion or YouTube do this convertion. So the colors are wrong ! :scared:

AzraelNewtype
1st September 2016, 03:18
An awful lot of players make assumptions about the colorspace based solely on the size of the video, leading to this. If you flagged it correctly and it still displays wrong, you are encountering a player that doesn't read the metadata and just assumes. In that case, yes you must convert, because that assumption will always be wrong otherwise. If you did not flag it correctly, do so first. If you can't control the client, it's probably always safest to assume it will do the dumb thing instead of the correct one.

SuperLumberjack
1st September 2016, 10:14
OK. Thanks ! :)

It's exactly the question I asked myself. How can I convert Rec.601 to Rec.709 (or flag the video correctly), without have a change of colors ?

It's what I tried with the codec "UtVideo YUV420 BT.709 VCM". Ant it works when I read the video. But I don't know why. On Dailymotion or YouTube, it converts the color matrix.

SuperLumberjack
1st September 2016, 10:27
Waouh ! I discovered that the problem is with all my video uploaded on Dailymotion. It's bad ! :rolleyes:

SuperLumberjack
1st September 2016, 11:19
I think the problem comes from the player of Dailymotion or my navigator :)

Because when I dowloaded the video from Daily, there is no problem ;)

SuperLumberjack
1st September 2016, 13:51
The problem comes from the navigator (I use Firefox). I donwloaded the video from Dailymotion and no problem.

There is the same problem with Google Chrome. But not for YouTube in this case, maybe because YouTube is Google :p

But no problem with the videos :)