VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. So I went back to this, after it got stalled for a few more months (I know, I know...).
    I got almost everything about right, except one thing that's been bugging me for hours yesterday — the end credits. When the credits start to appear — with egregious combing artifacts — the background video is still moving, until the first line reaches the top of the screen, at which point the credits continue to roll over a frozen frame. Processing the underlying video with TFM blurs it significantly and unnecessarily, so what I would like to do is to process the text area with TFM(), and leave the part of the frame above the text untouched, which means adjusting frame by frame which part of the frame gets processed (ideally with a seamless transition in-frame between the processed text area and the unprocessed video area), effectively resulting in a vertical “wipe” transition between the unprocessed clip and the processed clip. I figured that I could do that with either Animate() or ConditionalReader(), in combination with Overlay(), to dynamically change the cropping parameters for the unprocessed clip, but so far each of these attempts failed misebarly. From what I could read, Avisynth is generally a terrible tool when it comes to achieving that kind of effect. Is there any way to do that anyway ?

    I tried with Animate :
    Code:
    VCred = V.Trim(139949,0)
    Animate(VCred, 139949, 140034, "Crop",
        \ 0, 0, 0, 568,
        \ 0, 0, 0, 76)
    VCredCrop = last
    VCredTFM = VCred.TFM(cthresh=-1)
    VCredOver = Overlay(VCredTFM, VCredCrop)
    ## Error message : “initial and final video frame sizes must match” (only 1 match for a Web search with that specific expression, and not helpful at all ; I don't understand why it doesn't allow a variation of the frame size considering that it is used in combination with Overlay() and therefore the outcome of that clip should not have to conform to a constant frame size constraint, considering what has been stated in the aforementioned thread regarding Avisynth's smart processing ability)
    ...and ConditionalReader :
    Code:
    VCred = V.Trim(139949,0)
    VCredCrop = VCred.Crop(0, 0, 0, bottom)
    ConditionalReader("yoffset.txt", "bottom", false)
    VCredTFM = VCred.TFM(cthresh=-1)
    VCredOver = Overlay(VCredTFM, VCredCrop)
    ...with a “yoffset.txt” file containing the following :
    Code:
    Type int
    Default 0
    
    I 139950 140034 568 76
    ## Error message : “I don't know what 'bottom' means” (also tried with “myvar”, to no avail, although it is stated on the dedicated page : “Note the ConditionalReader line comes after any use of myvar in the script”)

    Yet another method would be to use a mask over the unprocessed clip (ideally with a blurred edge so as to get a seamless in-frame transition) and “lift” it gradually, but I wouldn't know how to go about doing something like this.

    Note : I had to set “cthresh=-1” so that it would process the very first frame where the credits appear at the bottom.

    Screenshot :
    Image
    [Attachment 59377 - Click to enlarge]


    Video sample :
    VTS_01_1 1h33m18s.demuxed.m2v
    Last edited by abolibibelot; 29th Oct 2021 at 07:58.
    Quote Quote  
  2. Why not something like:

    Code:
    Mpeg2Source("VTS_01_1 1h33m18s.demuxed.d2v", Info=3) 
    p1 = Trim(0,329)
    p2 = Trim(330,0).QTGMC(FPSDivisor=2)
    p1+p2
    or:

    Code:
    Mpeg2Source("VTS_01_1 1h33m18s.demuxed.d2v", Info=3) 
    p1 = Trim(0,329).SelectEvery(1,0,0)
    p2 = Trim(330,0).QTGMC()
    p1+p2
    Quote Quote  
  3. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    More transition effects: See TransAll
    Quote Quote  
  4. I think this is what you were originally trying to do:

    Code:
    function ScrollOverlay(clip c1, clip c2, int ypos)
    {
        patch=Crop(c2, 0, ypos, -0, -0)
        Overlay(c1, patch, x=0, y=ypos)
    }
    
    
    Mpeg2Source("VTS_01_1 1h33m18s.demuxed.d2v", Info=3) 
    
    s = ConvertToYV24()
    q = s.QTGMC(FPSDivisor=2)
    
    # titles start scrolling at frame 330 and reach the top at frame 428
    
    p1 = s.Trim(0, 329)
    p2 = Animate(330,428, "ScrollOverlay", s,q,568,  s,q,0).Trim(330,428)
    p3 = q.Trim(429,0)
    
    p1+p2+p3
    Or using a sliding mask:

    Code:
    source = Mpeg2Source("VTS_01_1 1h33m18s.demuxed.d2v", Info=3) 
    q = source.QTGMC(FPSDivisor=2)
    bwmask = StackVertical(BlankClip(source, color=color_black), BlankClip(source, color=color_white)).ColorYUV(cont_y=50).ConvertToY8()
    
    # titles start scrolling at frame 330 and reach the top at frame 428
    smask = Animate(328,428, "Crop", bwmask,0,0,0,source.height, bwmask,0,576,0,source.height)
    scroll = Overlay(source, q, mask=smask)
    
    p1 = source.Trim(0,329)
    p2 = scroll.Trim(330,428)
    p3 = q.Trim(429,0)
    
    p1+p2+p3
    Last edited by jagabo; 29th Oct 2021 at 16:15.
    Quote Quote  
  5. Why not something like:
    [QTGMC]
    1) No animation / smooth transition (but you provided a proper solution later).
    2) In my tests, QTGMC produced a definitely inferior result for that particular sequence, as I had mentioned in the aforementioned thread it seemingly treats the snow as noise and attempts to “clean” it or “stabilize” it through its motion estimation magic, resulting in an artificial aspect (I didn't play with the presets or specific settings to see if it would improve the outcome) ; there's no such effect with TFM's own post-processing or with nnedi3.
    Why converting to YV24 ? (Not allowed with TFM.)

    I think this is what you were originally trying to do:
    [ScrollOverlay / sliding mask]
    That's more like it, thanks !
    Is it possible with Avisynth to create a mask with a smooth gradation from black to white, over ~20 pixels for instance ?
    What is the purpose of .ColorYUV(cont_y=50) and .ConvertToY8() ?
    I'll have to do some further testing with Animate to understand why my attempt didn't work as expected.
    Quote Quote  
  6. Originally Posted by abolibibelot View Post
    2) In my tests, QTGMC produced a definitely inferior result for that particular sequence
    Yes, but who cares? It's only snow in the closing credits.

    Originally Posted by abolibibelot View Post
    Why converting to YV24 ? (Not allowed with TFM.)
    In the scripts with cropping the scrolling results in some odd Y values -- that doesn't work in YV12. You could alternatively use YUY2.

    Originally Posted by abolibibelot View Post
    Is it possible with Avisynth to create a mask with a smooth gradation from black to white, over ~20 pixels for instance ?
    One easy way to do that is vertically downscale the mask the scale it back up to the original size. Something like BilinearResize(width, height/16).BicubicResize(width,height). The blurry transition may let some of the interlaced titles bleed through so you may have to move it up a bit.

    Originally Posted by abolibibelot View Post
    What is the purpose of .ColorYUV(cont_y=50) and .ConvertToY8() ?
    BlankClip() will produce black at Y=16, and whites Y=235. Since this is being used as a mask we wan blacks at Y=0, whites at Y=255. And the original clip was YV12 -- the mask needed to be converted to a non-y--chroma-subsampled format for scrolling (again, odd values not allowed with YV12).
    Last edited by jagabo; 31st Oct 2021 at 09:47.
    Quote Quote  
  7. Another approach is to use a color mask to limit QTGMC to just the yellow text.

    Code:
    Mpeg2Source("VTS_01_1 1h33m18s.demuxed.d2v", CPU2="ooooxx", Info=3) 
    src = last
    
    
    q = QTGMC(FPSDivisor=2)
    
    cmask = q.MaskHS(StartHue=155, EndHue=170, MinSat=10).mt_expand().mt_expand().Blur(1.4)
    cmask = Overlay(cmask, cmask, y=-2, mode="add").BilinearResize(src.width, src.height)
    Overlay(src, q, mask=cmask)
    If you view the mask you'll see that it covers a bit of the yellow crosswalk lines too. Tuning the MaskHS parameters a bit more might eliminate that.
    Image Attached Files
    Quote Quote  



Similar Threads

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