VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    I'm trying to label my video encode with a picture at a certain point. I also want it to fade in. This is the code I'm trying to accomplish that with:
    global a1=last
    global a2=ImageReader("D:\David\Source Material\For Encoding or Editing\DBZ Remastered\Episode 231\Ep. 231.png", pixel_type="RGB32")
    JDL_ApplyRange(1350, 1553, "Overlay(a1, a2, mask=a2.ShowAlpha().FadeIn(27))")


    With just Overlay itself, the FadeIn works perfectly fine but obviously, the picture is there during the whole video. When I put it in the JDL_ApplyRange method, the image stays in between the frame numbers specified but it doesn't fade in. I think that's because JDL_ApplyRange isn't compatible with things that change frames around (though I'm not sure FadeIn does so..). I tried placing FadeIn in every place possible but it doesn't work anywhere. When I applied it to the end of JDL_ApplyRange, it told me it was incompatible with it and told me to use JDL_ApplyRangeOld. But, Overlay doesn't work in that function, so, any solutions you can think of?.. Greatly appreciated, thanks.
    Quote Quote  
  2. Why was the other thread locked on Doom9?

    The easiest way IMO would be to use trim() to apply the overlay in segments
    Quote Quote  
  3. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    Why was the other thread locked on Doom9?

    The easiest way IMO would be to use trim() to apply the overlay in segments
    If you really want to know the whole story I'll tell you, but basically, if you take my word for it, I was not rightfully banned. So they locked the thread because it was by me... Sigh... And very cool that you're here ^^

    To be honest, I tried Trim already but couldn't figure out how to use it properly. I don't really get it... I really only started all this stuff a couple months ago. I feel sorry that you practically have to baby me. Lol, but thanks man, I really appreciate it.
    Quote Quote  
  4. Gavino basically gave you the script in the other thread

    Think of Trim() as cutting in segments, so Trim(0,100) would return a video with frames 0 to 100

    Code:
    a1=mpeg2source("file.d2v")
    a2=ImageReader("logo.png",pixel_type="RGB32")
    
    a1.Trim(0,1376) ++ Overlay(a1.Trim(1377,1553),a2,mask=a2.ShowAlpha().FadeIO(27)) ++ a1.Trim(1554,0)
    There are 3 sections , from frames 0 to 1376, from 1377 to 1553, and from 1554 to end, each are split by the ++ which is an aligned splice in avisynth

    For some reason, the fade out isn't working with the overlay, only fade in works... I'll fiddle with it or maybe someone else knows why
    Quote Quote  
  5. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    Gavino basically gave you the script in the other thread

    Think of Trim() as cutting in segments, so Trim(0,100) would return a video with frames 0 to 100

    Code:
    a1=mpeg2source("file.d2v")
    a2=ImageReader("logo.png",pixel_type="RGB32")
    
    a1.Trim(0,1376) ++ Overlay(a1.Trim(1377,1553),a2,mask=a2.ShowAlpha().FadeIO(27)) ++ a1.Trim(1554,0)
    There are 3 sections , from frames 0 to 1376, from 1377 to 1553, and from 1554 to end, each are split by the ++ which is an aligned splice in avisynth

    For some reason, the fade out isn't working with the overlay, only fade in works... I'll fiddle with it or maybe someone else knows why
    OH! I get it now. That's very cool. Thank you. I only need FadeIn anyway so that's ok. Maybe someday they'll be kind enough to unban my account on doom9... The way everything played was just messed up...
    Quote Quote  
  6. OK if you use reverse() you can use fadeIN() , and on that cut sequence reverse it again to place it in with a Trim() command and it will look like a fade out. You have to get the frame#'s exact by working backwards because the end frame is now frame 0. I'd still like to know why the FadeOUT doesn't work with the overlay, but this should work as a workaround
    Quote Quote  
  7. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    OK if you use reverse() you can use fadeIN() , and on that cut sequence reverse it again to place it in with a Trim() command and it will look like a fade out. You have to get the frame#'s exact by working backwards because the end frame is now frame 0. I'd still like to know why the FadeOUT doesn't work with the overlay, but this should work as a workaround
    Try it with these instead and see if it works.

    Code:
    function FadeOutX(clip c, int frames)
    {
       return c.DeleteFrame(c.FrameCount-1).FadeOut(frames)
    }
    
    function FadeInX(clip c, int frames)
    {
       return c.DeleteFrame(0).FadeIn(frames)
    }
    Quote Quote  
  8. I was fooling around with it while you guys were posting back and forth, and came up with a different way to do it, using the Dissolve command:

    A=MPEG2Sourcempeg2source("file.d2v")
    B=ImageSource("logo.png",pixel_type="RGB32",End=20 3)
    X=A.Trim(0,1376)
    X=Dissolve(X,B,27)
    Y=A.Trim(1377,0)
    X+Y

    It's a 27 frame Dissolve (fade in), ending at frame number 1376 with the PNG lasting a total of 203 frames before going back to the original video. It could be made to dissolve out the same way (not needed apparently).
    Quote Quote  
  9. Typhoon - That function is basically the same as using FadeIn or FadeOut manually, but it has to be applied to the overlay segment, not the actual video portion. The problem seems to be with all types of FadeOUT, FadeOUT1, FadeOUT2, and the "out" portion of fadeIO versions for the overlay, not the video portion

    I can confirm, the reverse trick does work for the fade out, for the transparent overlayed section

    manono's script looks interesting, I'll play with it in a sec..
    Quote Quote  
  10. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by manono
    I was fooling around with it while you guys were posting back and forth, and came up with a different way to do it, using the Dissolve command:

    A=MPEG2Sourcempeg2source("file.d2v")
    B=ImageSource("logo.png",pixel_type="RGB32",End=20 3)
    X=A.Trim(0,1376)
    X=Dissolve(X,B,27)
    Y=A.Trim(1377,0)
    X+Y

    It's a 27 frame Dissolve (fade in), ending at frame number 1376 with the PNG lasting a total of 203 frames before going back to the original video. It could be made to dissolve out the same way (not needed apparently).
    I will try this. The way PoisonDeathRay suggested works perfectly though.
    Quote Quote  
  11. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    Typhoon - That function is basically the same as using FadeIn or FadeOut manually, but it has to be applied to the overlay segment, not the actual video portion. The problem seems to be with all types of FadeOUT, FadeOUT1, FadeOUT2, and the "out" portion of fadeIO versions for the overlay, not the video portion

    I can confirm, the reverse trick does work for the fade out, for the transparent overlayed section

    manono's script looks interesting, I'll play with it in a sec..
    I thought it might be because of the frame problem - that's why I suggested it.
    Quote Quote  
  12. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by manono
    I was fooling around with it while you guys were posting back and forth, and came up with a different way to do it, using the Dissolve command:

    A=MPEG2Sourcempeg2source("file.d2v")
    B=ImageSource("logo.png",pixel_type="RGB32",End=20 3)
    X=A.Trim(0,1376)
    X=Dissolve(X,B,27)
    Y=A.Trim(1377,0)
    X+Y

    It's a 27 frame Dissolve (fade in), ending at frame number 1376 with the PNG lasting a total of 203 frames before going back to the original video. It could be made to dissolve out the same way (not needed apparently).
    Dissolve won't work because A and B have to be the same formats.
    Quote Quote  
  13. This would be the "hack" using reverse() for the overlay fade out. I split it out to make it more clear for analysis

    Code:
    a1=Mpeg2Source("file.d2v")
    a2=ImageReader("logo.png",pixel_type="RGB32")
    
    b1=a1.Trim(0,1376)
    b2=Overlay(a1.Trim(1377,1500),a2,mask=a2.ShowAlpha().FadeIn(27))
    b3=Overlay(a1.Trim(1501,1553).Reverse(),a2,mask=a2.ShowAlpha().FadeIn(27))
    b4=a1.Trim(1554,0)
    
    b1++b2++b3.Reverse()++b4
    Quote Quote  
  14. Originally Posted by Typhoon859
    Dissolve won't work because A and B have to be the same formats.
    You want to explain what you mean by "same formats"? I've already tested this. Admittedly I used an AVI and a PNG, but it worked great - did just what I said it does in my post. I don't know why it has to be RGB32, as a DVD (and my AVI) is YV12, but I converted to RGB32 for the testing. It's simple and in its own little way, elegant, I think.
    Quote Quote  
  15. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    This would be the "hack" using reverse() for the overlay fade out. I split it out to make it more clear for analysis

    Code:
    a1=Mpeg2Source("file.d2v")
    a2=ImageReader("logo.png",pixel_type="RGB32")
    
    b1=a1.Trim(0,1376)
    b2=Overlay(a1.Trim(1377,1500),a2,mask=a2.ShowAlpha().FadeIn(27))
    b3=Overlay(a1.Trim(1501,1553).Reverse(),a2,mask=a2.ShowAlpha().FadeIn(27))
    b4=a1.Trim(1554,0)
    
    b1++b2++b3.reverse()++b4
    Wow. That's pretty smart. Indeed strange that FadeOut doesn't work regularly...
    Quote Quote  
  16. @manono - I think typhoon wants the transparent overlay to dissolve or fade, not the underlying video. It's not clear from this thread opening post what typhoon wanted, but I had the benefit of viewing the other thread, and he really should have made a better/more clear OP.... The RGB has to be 32 for the alpha channel to show through on the .png image, and the alpha needs to be called with ShowAlpha() in avisynth or the image will be 100% opaque, and the underlying video portion will not be visible behind the overlay section

    I might be missing something, but I can't get your script to work either...
    Quote Quote  
  17. Member
    Join Date
    May 2009
    Location
    United States
    Search PM
    Originally Posted by poisondeathray
    @manono - I think typhoon wants the transparent overlay to dissolve or fade, not the underlying video. It's not clear from this thread opening post what typhoon wanted, but I had the benefit of viewing the other thread, and he really should have made a better/more clear OP.... The RGB has to be 32 for the alpha channel to show through on the .png image, and the alpha needs to be called with ShowAlpha() in avisynth or the image will be 100% opaque, and the underlying video portion will not be visible behind the overlay section

    I might be missing something, but I can't get your script to work either...
    Oh, right. My bad. I should've made that more clear. Ummm, well, I knew that it was the video that would be faded in there but I just wanted to see if it worked to then modify it for my purposes. I'm sure that idea can be worked out somehow, with the Disolve.
    Quote Quote  
  18. Originally Posted by poisondeathray
    @manono - I think typhoon wants the transparent overlay to dissolve or fade, not the underlying video. It's not clear from this thread opening post what typhoon wanted, but I had the benefit of viewing the other thread, and he really should have made a better/more clear OP
    Oh, OK. I don't know the other thread. You seem to be saying that the underlying video is still visible after the PNG is faded in which, of course, my script won't do. But then, as you also say, there's nothing at all about requiring that in the earlier posts. All I see is him wanting a picture to be faded in and kept there for a few seconds. Thanks for the clarification.

    I guess there's no need now for anyone to get it to work. But by fooling around and doing it myself I learned something that may come in handy in the future. About all I did that's not in the posted script was to resize the PNG to the resolution of my test AVI and convert the AVI's colorspace to RGB32.
    Quote Quote  
  19. Originally Posted by manono
    About all I did that's not in the posted script was to resize the PNG to the resolution of my test AVI and convert the AVI's colorspace to RGB32.
    OK thanx, I did resize the png to match , but I forgot the AVI colorspace! Overlay() doesn't require matching colorspaces
    Quote Quote  



Similar Threads

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