VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    Mar 2014
    Location
    Brazil, Rio de Janeiro
    Search Comp PM
    All I want to do is decrease my video's saturation to 75% and increase its gamma to 150%. I'm terrible with .avs stuff though, here is my naive attempt:

    AVISource("castle.avi")

    saturation = 0.75
    gamma = 1.5
    Then I throw this .avs on virtualdub and get this error: "The script's return was not a video clip, (Is the undefined value)."

    What am I doing wrong?
    Quote Quote  
  2. Code:
    Tweak(sat=0.75)
    ColorYUV(gamma_y=128)
    or with ColorYUV only:

    Code:
    ColorYUV(gamma_y=128, cont_u=-64, cont_v=-64)
    Last edited by jagabo; 30th Oct 2017 at 06:59.
    Quote Quote  
  3. Member
    Join Date
    Mar 2014
    Location
    Brazil, Rio de Janeiro
    Search Comp PM
    My file is a RGB though...
    Quote Quote  
  4. Levels supports RGB. You can adjust the gamma like this.
    Levels(0, 1.5, 255, 0, 255, Coring=false)

    RGBAdjust would probably do the equivalent of adjusting the saturation
    RGBAdjust(0.75, 0.75, 0.75)
    Thinking about it, RGBAdjust should be able to do both. Something like this, I think.
    RGBAdjust(R=0.75, G=0.75, B=0.75, RG=1.5, GG=1.5, BG=1.5)
    Quote Quote  
  5. To decrease saturation you need to convert to YUV (and then back again if you want to stay in RGB)
    Code:
    ConvertToYV24
    Levels(0, 1.5, 255, 0, 255, coring=false)
    Tweak(sat=0.75)
    ConvertToRGB24
    (EDIT)
    Last edited by raffriff42; 1st Nov 2017 at 16:34.
    Quote Quote  
  6. Originally Posted by hello_hello View Post
    RGBAdjust would probably do the equivalent of adjusting the saturation
    RGBAdjust(0.75, 0.75, 0.75)
    That darkens the picture and is very different from a 0.75 saturation adjustment. Try this script:

    Code:
    function RGBSat(clip c, float val)
    {
       RGBAdjust(c, r=val, g=val, b=val)
       Subtitle("RGBAdjust(rgb="+String(val)+")")
    }
    
    function YUVSat(clip c, float val)
    {
       Tweak(c, sat=val)
       Subtitle("Tweak(sat="+String(val)+")")
    }
    
    src = ColorBars().Crop(0,0,640,80).Trim(0,100).RGBAdjust(r=2.0, g=2.0, b=2.0, rb=-100, gb=-100, bb=-100)
    
    rgb = Animate(0,100, "RGBSat", src,1.0, src,0.0)
    yuv = Animate(0,100, "YUVSat", src.ConvertToYV24(),1.0, src.ConvertToYV24(),0.0).ConvertToRGB()
    
    StackVertical(src, rgb, yuv)
    Click image for larger version

Name:	sat50.png
Views:	465
Size:	9.5 KB
ID:	43544

    At sat=0 your RGBAdjust(rgb=0) will result in black for all source colors. Tweak(sat=0) will result in different greys for different source colors.

    Click image for larger version

Name:	sat0.png
Views:	469
Size:	7.2 KB
ID:	43545

    Originally Posted by hello_hello View Post
    Thinking about it, RGBAdjust should be able to do both. Something like this, I think.
    RGBAdjust(R=0.75, G=0.75, B=0.75, RG=1.5, GG=1.5, BG=1.5)
    RGB gamma is also different from YUV gamma.
    Last edited by jagabo; 30th Oct 2017 at 10:21.
    Quote Quote  
  7. Member
    Join Date
    May 2014
    Location
    Memphis TN, US
    Search PM
    Since nobody has a smaple of that video, everyone's just guessing anyway. How de we know gamma and saturation are the problems?

    Note that tweak() and Levels() have coring = true by default. Why use "coring=false" for Levels() and not use it for Tweak()?
    - My sister Ann's brother
    Quote Quote  
  8. Originally Posted by LMotlow View Post
    Note that tweak() and Levels() have coring = true by default. Why use "coring=false" for Levels() and not use it for Tweak()?
    I've never noticed a problem with Tweak() because I think it just clips the levels on output, but Levels() can result in a visibly different output at times.

    http://avisynth.nl/index.php/Levels

    output = ( (input - input_low) / (input_high - input_low) )(1 / gamma) * (output_high - output_low) + output_low

    When coring=true, input luma is clamped to the range 16-235 and the chroma to 16-240;
    This clamped input is scaled from 16-235 to 0-255,
    The conversion takes place according to the transfer function above, and then
    Output is scaled back to 16-235.
    When coring=false, the conversion takes place according to the transfer function, without any scaling.

    So if I do this:
    Levels(0, 1.0, 255, 16, 235) isn't everything below 16 & above 235 clipped to 16-235, before it's converted to 16-235? It seems a bit odd to me.
    Quote Quote  
  9. Originally Posted by hello_hello View Post
    So if I do this:
    Levels(0, 1.0, 255, 16, 235) isn't everything below 16 & above 235 clipped to 16-235, before it's converted to 16-235?
    Yes. You can see it here:

    Click image for larger version

Name:	levels.jpg
Views:	479
Size:	14.4 KB
ID:	43594

    On the left is a greyscale ramp from Y=0 to Y=255. In the middle is the result of Levels(0, 1.0, 255, 16, 235) (coring=true is the default). You can see that the values below 16 and above 235 were crushed before the levels change. On the right is the result of Levels(0, 1.0, 255, 16, 235, coring=false). You can see that the crushing did not occur.
    Quote Quote  
  10. Member
    Join Date
    Mar 2014
    Location
    Brazil, Rio de Janeiro
    Search Comp PM
    I'm sorry for not replying to this sooner, but I solved my problem with this filter.

    I realized changing the saturation isn't really necessary, so I just set the Global gamma to -50 and left the rest as it is.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!