VideoHelp Forum

+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    I'm loading AviSynth scripts in VirtualDub to edit shots in DVD videos. Some shots in the resulting processed videos are beginning or ending on a different frame from what is shown in VirtualDub (before processing the video). So I'm ending up with a frame from a shot I don't want to show sometimes showing. This is turning out to be a huge problem to correct, because each video takes me more than 5 hours to process. So I have to wait 5+ hours just to see if one shot is beginning or ending on the correct frame.

    Is there a way I can see the actual frame I'll be cutting on before I process the video? Or what is the correct way to do this so I don't end up with videos that show frames from shots I don't want to show?

    Edit: I'm also using Srestore and QTGMC to improve video quality, if that matters. I should also mention that I haven't noticed this problem with frames when adding a deblocker to the AVS script.
    Quote Quote  
  2. Aren't you using AviSynth's Crop filter to define the parts you want to keep? Then VDub will show you the parts you're keeping before you do the encode.

    Make sure to crop before screwing with the framerate with QTGMC. What kind of video are you editing (DVD, you said?) and what source filter are you using (MPEG2Source, I hope)?
    Quote Quote  
  3. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    What you're saying about the Crop filter makes me think maybe I'm not using the correct terminology. I haven't been using the Crop filter because I'm not trying to carve down the shape of the frame, I'm trying to prevent a fame from appearing in its entirety. So when I was talking about cutting, I meant in terms of frame sequence, not size, shape, dimensions, etc.

    Does what you're saying still apply? If so, I would actually prefer to do my cuts before using QTGMC because it's faster, but for this particular video and script, I've been cutting after QTGMC because cropping before QTGMC results in one of the overlay images I'm using in a replacement shot to bounce up and down.

    The video I'm editing is DVD, and I am using MPEG2Source. The output file is AVI.
    Quote Quote  
  4. Originally Posted by lomaidala View Post
    Does what you're saying still apply?
    I apologize. You're absolutely right. I meant to say Trim. Have you been using Trims to keep what you want? With MPEG2Source, using Trims should encode the way you want. You can even check your work to make sure you got the frame numbers correct before doing the encoding. Again, perform the Trims before doing any filtering that messes with the framecount, unless you're very careful about how you do it.

    If already using Trims, maybe post a script that results in the wrong frames being encoded.
    Quote Quote  
  5. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    No problem. I have been using Trim to try and keep what I want. Is there a way to Trim before using filters that mess with frame count, and also prevent the problem overlay I mentioned (ovl5) from bouncing?

    Originally Posted by manono View Post
    You can even check your work to make sure you got the frame numbers correct before doing the encoding.
    I assume here you're not talking about anything beyond simply viewing the frames and corresponding numbers as they appear in VirtualDub? Or is there some other trick? I've noticed when doing this that the frame being shown does not always match its corresponding number. I think I remember someone here saying that was due to random seeks, if I recall correctly.

    Here's my script:
    Code:
    LoadPlugin("C:\DVD\DGDecode.dll")
    clip1 = MPEG2Source("C:\DVD\01\VTS_01_1.d2v")
    clip2 = MPEG2Source("C:\DVD\02\VTS_01_1.d2v")
    clip1 = clip1.QTGMC( Preset="Placebo" )
    clip2 = clip2.QTGMC( Preset="Placebo" )
    clip1 = clip1.Srestore(Frate=23.976)
    clip2 = clip2.Srestore(Frate=23.976)
    ovl1 = ImageSource("C:\Images\01\01.png")
    ovl2 = ImageSource("C:\Images\01\02.png")
    ovl3 = ImageSource("C:\Images\01\03.png")
    ovl4_1 = ImageSource("C:\Images\01\04a.png", pixel_type="RGB32", start=0, end=12, fps=clip1.framerate)
    ovl4_2 = ImageSource("C:\Images\01\04b.png", pixel_type="RGB32", start=0, end=3, fps=clip1.framerate)
    ovl4_3 = ImageSource("C:\Images\01\04a.png", pixel_type="RGB32", start=0, end=13, fps=clip1.framerate)
    ovl4_4 = ImageSource("C:\Images\01\04b.png", pixel_type="RGB32", start=0, end=3, fps=clip1.framerate)
    ovl4_5 = ImageSource("C:\Images\01\04a.png", pixel_type="RGB32", start=0, end=57, fps=clip1.framerate)
    ovl5 = ImageSource("C:\Images\01\05.png", pixel_type="RGB32")
    ovl6 = ImageSource("C:\Images\01\06.png")
    ovl7 = ImageSource("C:\Images\01\07.png", pixel_type="RGB32", start=0, end=62, fps=clip1.framerate)
    ovl7 = Animate(ovl7, 39, 62, "Spline36Resize",   720,480,0,0,0,0, 720,480,0,-480,0,-480)
    
    #4_1
    function CropSection(clip vid, float xpos, float ypos, int width, int height)
    {
        BicubicResize(vid, width, height, src_left=xpos, src_top=ypos, src_width=width, src_height=height)
    }
    ovl4_1 = Animate(0,12, "CropSection", ovl4_1,996.0, 194.0,clip1.width,clip1.height,\
                                         ovl4_1,860.1818181818, 167.5454545455,clip1.width,clip1.height)
    
    #4_2
    function CropSection(clip vid, float xpos, float ypos, int width, int height)
    {
        BicubicResize(vid, width, height, src_left=xpos, src_top=ypos, src_width=width, src_height=height)
    }
    ovl4_2 = Animate(0,3, "CropSection", ovl4_2,848.8636363636, 165.3409090909,clip1.width,clip1.height,\
                                         ovl4_2,826.2272727273, 160.9318181818,clip1.width,clip1.height)
    
    #4_3
    function CropSection(clip vid, float xpos, float ypos, int width, int height)
    {
        BicubicResize(vid, width, height, src_left=xpos, src_top=ypos, src_width=width, src_height=height)
    }
    ovl4_3 = Animate(0,13, "CropSection", ovl4_3,814.9090909091, 158.7272727273,clip1.width,clip1.height,\
                                         ovl4_3,679.0909090909, 132.2727272727,clip1.width,clip1.height)
    
    #4_4
    function CropSection(clip vid, float xpos, float ypos, int width, int height)
    {
        BicubicResize(vid, width, height, src_left=xpos, src_top=ypos, src_width=width, src_height=height)
    }
    ovl4_4 = Animate(0,3, "CropSection", ovl4_4,667.7727272727, 130.0681818182,clip1.width,clip1.height,\
                                         ovl4_4,645.1363636364, 125.6590909091,clip1.width,clip1.height)
    
    #4_5
    function CropSection(clip vid, float xpos, float ypos, int width, int height)
    {
        BicubicResize(vid, width, height, src_left=xpos, src_top=ypos, src_width=width, src_height=height)
    }
    ovl4_5 = Animate(0,57, "CropSection", ovl4_5,633.8181818182, 123.4545454545,clip1.width,clip1.height,\
                                         ovl4_5,0.0, 0.0,clip1.width,clip1.height)
    
    alpha_mask5 = ovl5.ShowAlpha
    alpha_mask7 = ovl7.ShowAlpha
    ovl1 = ovl1.ConvertToYV12
    ovl2 = ovl2.ConvertToYV12
    ovl3 = ovl3.ConvertToYV12
    ovl4_1 = ovl4_1.ConvertToYV12
    ovl4_2 = ovl4_2.ConvertToYV12
    ovl4_3 = ovl4_3.ConvertToYV12
    ovl4_4 = ovl4_4.ConvertToYV12
    ovl4_5 = ovl4_5.ConvertToYV12
    ovl5 = ovl5.ConvertToYV12
    ovl6 = ovl6.ConvertToYV12
    ovl7 = ovl7.ConvertToYV12
    clip2.Trim(0,7) + \
    clip2.Trim(0,2167).FadeOut(15) + \
    clip1.Trim(2177,3173) + \
    clip1.Trim(3174,3233).Overlay(ovl1) + \
    clip1.Trim(3234,3519) + \
    clip1.Trim(3520,3583).Overlay(ovl2) + \
    clip1.Trim(3584,3920) + \
    clip1.Trim(3921,3981).Overlay(ovl3) + \
    clip1.Trim(3982,4683) + \
    clip1.Trim(4684,4696).Overlay(ovl4_1).Overlay(ovl5, mask=alpha_mask5) + \
    clip1.Trim(4697,4700).Overlay(ovl4_2).Overlay(ovl5, mask=alpha_mask5) + \
    clip1.Trim(4701,4714).Overlay(ovl4_3).Overlay(ovl5, mask=alpha_mask5) + \
    clip1.Trim(4715,4718).Overlay(ovl4_4).Overlay(ovl5, mask=alpha_mask5) + \
    clip1.Trim(4719,4776).Overlay(ovl4_5).Overlay(ovl5, mask=alpha_mask5) + \
    clip1.Trim(4777,14733) + \
    clip1.Trim(14734,14765).Overlay(ovl6) + \
    clip1.Trim(14766,16002) + \
    clip1.Trim(16003,16065).Overlay(ovl7, mask=alpha_mask7) + \
    clip1.Trim(16066,0)
    TextSub("C:\Overlays\01.ass")
    I've noticed two issues. The first is that the original frame 4776 (before being covered with my overlay) shows where I tell 4777 to show. 4776 and 4777 in the source video are two different shots, so this is a problem.

    The second issue is that the timing of ovl7 appears to start earlier in the processed video than it appears to in Vdub before processing, and as a result, it doesn't completely cover what it's supposed to in the processed video even though it does cover the part of the shot I want it to in VDub before processing.
    Quote Quote  
  6. For the seek issue , likely the culprit is srestore. This filter requires linear access. If you jump around the timeline it will mix up frames for certain

    mpeg2source, imagesource are ok . Even QTGMC is OK for the most part for random seeks

    One approach would be to split it up into steps, using lossless intermediates . For example encode clip1 and clip2 with qtgmc+srestore, then reference those in a 2nd script
    Quote Quote  
  7. Originally Posted by lomaidala View Post
    Here's my script:
    Code:
    LoadPlugin("C:\DVD\DGDecode.dll")
    clip1 = MPEG2Source("C:\DVD\01\VTS_01_1.d2v")
    clip2 = MPEG2Source("C:\DVD\02\VTS_01_1.d2v")
    Open both VOBs at the same time in DGIndex and make a single D2V project file. When opening, either corral them both with the mouse or use the "Add" button to add the second one after opening the first.

    Doing that will allow you to simplify your script greatly. And, yes, having all those Trims at the end of the script will make it about impossible to get the frame numbers correct.
    Quote Quote  



Similar Threads