Log in

View Full Version : ColorYUV(levels="PC->TV") not working?


zambelli
9th September 2005, 11:14
Are there any instances where ColorYUV(levels="PC->TV") would not compress 0..255 luma range to 16..235? Because I have a clip where that's exactly what's happening and I can't figure out why.

Here's my script:

MPEG2Source("FriAct2HD.d2v", idct=5)

ConvertToYUY2(interlaced=false)

# Compress luma range
ColorYUV(levels="PC->TV")

Crop(104,96,1080,608)

# Resize to SD
LanczosResize(720,480)

audio = DirectShowSource("FriAct2HD.mpa")

# Mux
AudioDub(last, audio)

# Delay audio to compensate for original MPA delay
DelayAudio(0.03)

ColorYUV(analyze=true)

The luma range in the original video is 0..255 on every frame... which is a bit unusual to start with. After I apply the script, the luma range varies from frame to frame with min values usually below 5 and max above 250.

Here's an example of a processed frame:

After ColorYUV(levels="PC->TV") (http://www.citizeninsomniac.com/images/Luma.png)

Why aren't the values in the 16..235 range?

Didée
9th September 2005, 11:26
Because of the resizer. By the resampling process, new interpolated pixel values are created. Since LanczosResize is a "sharp" resizer, it will create new out-of-range pixel values.

Try:

limiter()
stackvertical( last.coloryuv(analyze=true),
\ last.lanczosresize(last.width-32,last.height-24)
\ .lanczosresize(last.width,last.height)
\ .coloryuv(analyze=true) )

zambelli
9th September 2005, 12:16
Because of the resizer. By the resampling process, new interpolated pixel values are created. Since LanczosResize is a "sharp" resizer, it will create new out-of-range pixel values.

Bingo! Thanks, Didée. Would this be the optimal order then?

MPEG2Source("FriAct2HD.d2v", idct=5)

ConvertToYUY2(interlaced=false)

Crop(104,96,1080,608)

# Resize to SD
LanczosResize(720,480)

# Compress luma range
ColorYUV(levels="PC->TV")
Actually, since I'm scaling from 1280x720 to 720x480, should I just do a Bilinear or Bicubic resize instead?