HuffYUV RGB->YUY2 conversion: TV/PC scale?

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby mirkosp » Thu Jul 01, 2010 7:59 am

My bad, seems that convert hasn't had updates in 2.5.7 and 2.5.8 (I was asking that cause I saw 2.5.6 in the documentation bit you quoted). There's some new stuff in 2.6a however, but I'm not sure if defaults behaviour has been touched.
Still, with the "Also you seem to think that it's rescaling your video when it isn't." line, I think he was referring to the NLE and not to AviSynth anyway. >_>
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Mister Hatt » Fri Jul 02, 2010 2:40 am

The new Convert stuff in 2.6a is totally worth upgrading for alone, ConvertToYV24() f.e. will let you crop odd pixels in YV12 video without destroying colourimetry.

As far as the docu there and the confusion between RGB[0,255]<->YUV[16,235], it's actually written really badly. If you are converting RGB to YUV with PC levels then yes, it will use [0,255]. If you are converting RGB to YUV with TV levels, it will use [16,235]. If you are converting YUV[0,255] to RGB with PC levels it will give you [0,255]. However, if you are converting YUV[16,235] to RGB with PC levels it will NOT auto rescale everything other than pure 0 and 255. 17 f.e. will stay as 17, it won't be dropped down to 1. That's as far as I understand it anyway, from testing and RTFS etc.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Scintilla » Mon Jul 19, 2010 8:19 pm

I think I've finally managed to answer my own question after a fair deal of testing. Major takeaways are in blue.

I started off by exporting the same video from Adobe Premiere Pro two ways: to HuffYUV in RGB mode, and then to HuffYUV in YUY2 mode.
I then wrote up an AVISynth script to convert them to YV12 (using the default (Rec601) matrix for the RGB clip) and mt_binarized them at a few different threshold values, including 234, so that any slight differences in the luma values of the two clips would be obvious.

There weren't any -- the results of the binarize were identical. In other words, it appears that HuffYUV uses the Rec601 (TV scale) matrix to do its RGB-to-YUY2 conversion.

I compared these back to my source episode's script, YV12 straight from the VOB with no colorspace conversion, also binarized, at the same frames. There were only the tiniest of differences; it wasn't until I tried converting the RGB export clip to YV12 with the PC.601 matrix that the luma differences were noticeable. For all intents and purposes, the HuffYUV files matched the original source.

For good measure, I tried using the Histogram function too, which confirmed that all of the videos I was looking at stayed in-bounds with the luma -- nothing in the invalid zones outside [16,235].

However, the contest coordinator was right. My encode out of TMPGEnc DID go out of the TV range, as I saw when I slapped a Histogram on that. The culprit is TMPGEnc's "Output YUV data as Basic YCbCr not CCIR601" option, on the Quantize Matrix tab. So, this is something I might want to add to the MPEG-2 encoding guide, so as not to blind audiences.

The upshot of all this is twofold:
1) I can stop worrying that HuffYUV is converting to YUV wrong
2) I can make my white mattes (255, 255, 255) in Premiere Pro, not (245, 245, 245) like I've been doing for years, because they'll get scaled properly later on


... in fact, I just might do that to my Otakon video and re-export. It was kind of embarrassing to see the values on the right edge of the histogram back off when going into my white flashes. That's not intense or exciting at all.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:
User avatar
Scintilla
(for EXTREME)
 
Joined: 31 Mar 2003
Location: New Jersey
Status: Quo

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Mister Hatt » Wed Jul 21, 2010 11:04 am

So when I said that TV scale colours would look the same on PC scale, that didn't make sense? You seem to have made that exact same conclusion. Using PC scale for extra stuff is fine as long as you understand that the TV scaled stuff won't rescale itself. Everything will still look normal at PC levels. Converting your PC scale stuff to TV however will be lossy.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Scintilla » Wed Jul 21, 2010 6:48 pm

See, now you have me going back over the previous posts and trying to figure out where the misunderstanding happened. I think you thought I was talking about converting TV YUV to RGB using the PC matrix; I always intended to convert to RGB with the TV matrix, it's just how to convert back to YUV afterwards that was the question.

Because as far as I see, everything you said was correct, but so was everything I said -- with the exception of: "In that case, [...] there would be no harm in keeping it full scale when converting back to YV12 for playback on a computer monitor, correct?".
What I didn't realize when I said that was that whatever video decoder is handling the output in VirtualDub is apparently rendering YUV according to the TV matrix... so if I convert RGB to YUV using the PC scale, all whites above 235 (as verified by the Histogram) just show up as (255, 255, 255) when I screencap and view in The GIMP.

So, it's not a good idea to convert back to YUV using PC scale, because my display doesn't use the extra luma range anyway -- it clips.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:
User avatar
Scintilla
(for EXTREME)
 
Joined: 31 Mar 2003
Location: New Jersey
Status: Quo

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Mister Hatt » Fri Jul 23, 2010 5:10 pm

Not your display, the encoder. The solution would be to use a better encoder. I know x264 can do it without clipping as long as your input is correct.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Re: HuffYUV RGB->YUY2 conversion: TV/PC scale?

Postby Scintilla » Fri Jul 23, 2010 6:05 pm

It's not the encoder, because I'm not encoding anything: I'm just viewing the AVISynth script with the Histogram on it verifying that I have luma values in the [0,16] and [235,255] ranges.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:
User avatar
Scintilla
(for EXTREME)
 
Joined: 31 Mar 2003
Location: New Jersey
Status: Quo

Previous

Return to Footage Help

Who is online

Users browsing this forum: No registered users and 2 guests