VideoHelp Forum




+ Reply to Thread
Results 1 to 20 of 20
  1. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    I have been recording the same event from two different DV Camcorders, capturing to either DV AVI intelaced, or WMV interlaced files (depending on how I felt about quality vs hard drive space on each given day.)

    So, I end up with two videos, each starting at two slightly different points in time showing the same thing.

    Manually, I can find the field (half-frame) in stream A that matches the same point in time in stream B. For that I use VirtualDub with bob doubler internal plugin.

    So, for instance, frame 4.5 (i.e., 4th (interlaced) frame, top field) in stream A is matched with frame 300 (i.e., 300th frame, bottom field) in stream B. So, the "difference" here is 295.5 frames.

    Now, I'd like to see both views next to each other in VirtualDub.

    For that, I have been struggling to figure out the following AviSynth script.

    -It should open both video files.
    -It should be able to reference the fields, rather than the frames (same thing that bob doubler does in VirtualDub).
    -It should offset one video by the "frame difference" (see above), so that if it needs to display frame 300 in my stream B, it knows to display frame 300-295.5 (=4.5) in my stream A (and obviously, black frames in stream A, if I display anything less than 295.5 in stream B).
    -It should resize the frames, since my capture is standard 720x480, but in one case AR is 4:3 and in another 16:9, to square pixels of my choosing (I'd like to play with different sizes - I just want the aspect ratio to be right).
    -Finally, it should display the two videos side by side. (Oh, and the audio, I only need to hear it from one of the video files).


    So far my attempts have been pathetic.
    Even this simple thing doesn't work all the way - I don't get any audio:

    Code:
    stream_a = AVISource("C:\RAW_DATA\Media\stream_A1.avi", audio=True).BilinearResize(720, 540, 8, 0, 720, 480)
    stream_b = AVISource("C:\RAW_DATA\Media\stream_B1.avi").BilinearResize(960, 540, 8, 0, 720, 480)
    StackHorizontal(stream_a, stream_b)

    Apprectiate any help, tx.
    Quote Quote  
  2. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    The reason you get no audio is that AviSource does not handle audio in a Type 1 DV file.
    Use Type 2 DV, or use DirectShowSource to read Type 1.
    Also, I think BilinearResize(..., 720, 480) should be (..., 704, 480).

    For your other requirements, you need to bob-deinterlace (eg with Yadif(mode=1, order=0)) to get 59.94fps progressive, then each original field becomes a separate frame and you can line them up exactly by adding blank frames at the start of the 'later' clip.
    For your example, after deinterlacing:
    A = BlankClip(A, 591) + A # 591 = 2 x 295.5
    Last edited by Gavino; 11th Nov 2010 at 03:51. Reason: mention Yadif
    Quote Quote  
  3. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Thanks, Gavino.

    But I must have entered "thick zone".

    I have C:\Program Files\AviSynth 2.5\plugins\yadif.dll (downloaded from http://avisynth.org.ru/yadif/yadif.html)
    I have this line in my script:
    Code:
    stream_a = DirectShowSource("stream1A.avi", audio=True).BilinearResize(640, 480, 8, 0, 720, 480).Yadif(mode=1, order=0)
    And yet, when I pull it into VirtualDub, I get:
    ---------------------------
    VirtualDub Error
    ---------------------------
    Avisynth open failure:
    Script error: there is no function named "Yadif"
    (C:\RAW_DATA\Media\test.avs, line 1)
    ---------------------------
    OK
    ---------------------------


    Also, regarding 704,480, I did see that too, somewhere. But I didn't understand: I thought 720x480 = 4:3 or 16:9.

    Well, according to this https://forum.videohelp.com/threads/269644-DV-to-704x480-or-720x480, no. It's actually 704x480 with padding of 8 pixels on either side (that gets cut off by most TVs).
    Therefore, what my DV Camcorder actually gives me with its 720x480 is ... lets see...4.0909 : 3, yes?
    I 'd prefer not to cut anything off, of course.
    Quote Quote  
  4. yadif is a different type of filter that has to be manually loaded . It's a "C" plugin

    Load_Stdcall_Plugin("C:\PATH\yadif.dll")
    Quote Quote  
  5. Originally Posted by a1s2d3f4 View Post
    Also, regarding 704,480, I did see that too, somewhere. But I didn't understand: I thought 720x480 = 4:3 or 16:9.

    Well, according to this https://forum.videohelp.com/threads/269644-DV-to-704x480-or-720x480, no. It's actually 704x480 with padding of 8 pixels on either side (that gets cut off by most TVs).
    Therefore, what my DV Camcorder actually gives me with its 720x480 is ... lets see...4.0909 : 3, yes?
    I 'd prefer not to cut anything off, of course.
    He was talking about this part of the script:

    BilinearResize(640, 480, 8, 0, 720, 480)

    If you don't want to cut anything off, then that part of the script is incorrect. He was figuring you had 8 columns of pixels on each side to be removed and, if so, the line should be:

    BilinearResize(640, 480, 8, 0, 704, 480)

    And even if there aren't 8 columns of black pixels on each side, to keep a proper aspect ratio it should still be cropped like that. And if it's really active video that you don't want cropped, then you wouldn't resize to 640x480 but maybe 656x480.
    Quote Quote  
  6. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Ah.. thanks.

    Well, almost seem to be there. Except, after adding this Yadif call I can no longer view my video in VirtualDub while its active. I just get green instead of the video. As soon as I Alt-Tab to a different application (like notepad with my .avs script), I can see that behind it the video re-appears and shows normally in VirtualDub, but as soon as I activate VirtualDub (bring it to the front) it turns back to green - what gives?
    Quote Quote  
  7. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    @manono

    Yeah. Well, technically speaking 640 should become 654.5455, but because it's not exactly "divisible by 4", 656 seems like a good number.
    Quote Quote  
  8. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    And correct: my DV camcorder doesn't give me any "vertical black bars" on the sides - it's useful image everywhere
    Quote Quote  
  9. that is an odd behaviour... do you have another video player open simultaneously ? if so close it.

    if you scrub the timeline in vdub, does preview come back?

    try changing the vdub preferences for display : options=>preferences=>display . Try disabling direct x.
    Quote Quote  
  10. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Ok, I just confirmed that Yadif has nothing to do with it - it happens without that call also.
    Your suggestion to disable direct x did the trick - thanks.

    While I have this thread going - how do I also delay my out-of-sync audio (this is for files captured through WMEncoder, where the audio stream was from my external sound card, not DV Camcorder)?
    Quote Quote  
  11. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by a1s2d3f4 View Post
    how do I also delay my out-of-sync audio (this is for files captured through WMEncoder, where the audio stream was from my external sound card, not DV Camcorder)?
    http://avisynth.org/mediawiki/DelayAudio
    Quote Quote  
  12. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Ok, great. Am I correct to make the .AudioDelay call inline with StackHorizontal?
    Quote Quote  
  13. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Yes, that's one way to do it, eg
    StackHorizontal(stream_a, stream_b).DelayAudio(0.5)

    You could also attach it to the input clip filter chain instead, eg
    stream_a = AviSource(...). ... .DelayAudio(0.5)

    Or just add a separate line at the end
    DelayAudio(0.5)

    All have the same final result.
    Quote Quote  
  14. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Sounds good.

    In the interest of polishing this further, is there anything out there that's more "lightweight" than Yadif (which, I think, does some serious frame comparisons when it operates)?
    With it, my CPU usage climbs to 100% when I try playing back my synced videos and so it's not a smooth experience.
    All I need is to separate my fields BFF - very predictable.
    Quote Quote  
  15. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Actually, Yadif is fairly fast - the top-quality deinterlacers are many times slower.
    You could also try LeakKernelDeint(), or even the built-in Bob().

    BTW It is not simply separating the fields - it also has to interpolate the missing lines - otherwise you would get a half-height image that bobs up and down on each new frame.
    Quote Quote  
  16. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Ok, thanks for letting me know. My solution to smooth playback problem: set virtualdub to process every other frame (Video->Frame Rate). That way, when I hit Enter to playback, it doesn't show every frame, but that's ok. I don't need 59.94 fps. Then when I want to study the motion frame by frame I can stop and use my arrows/mouse wheel and get to see every frame.

    Thanks for all the help.
    I have more related questions which I will ask in different threads.
    Quote Quote  
  17. You can also use 'trim' to sync up the two sources by cutting short the longer source. Or if you want to add frames to the shorter source, I find it easier to use stream_a=stream_a.trim(0,-1).loop(f) to make copies of the first frame rather than messing with blankclip.

    Darryl

    (correction after reading Gavino's reply)

    stream_a=stream_a.trim(0,-1).loop(f)+stream_a
    Last edited by dphirschler; 12th Nov 2010 at 12:47.
    Quote Quote  
  18. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by dphirschler View Post
    if you want to add frames to the shorter source, I find it easier to use stream_a=stream_a.trim(0,-1).loop(f) to make copies of the first frame rather than messing with blankclip.
    Yes, that's a useful alternative. But you would still have to add the extra frames in with the '+' operator:
    stream_a=stream_a.trim(0,-1).loop(f) + stream_a

    Simpler is to use the Loop function like this:
    stream_a = stream_a.Loop(f+1, 0, 0)
    which adds f copies of the first frame.
    Quote Quote  
  19. Originally Posted by Gavino View Post
    Simpler is to use the Loop function like this:
    stream_a = stream_a.Loop(f+1, 0, 0)
    which adds f copies of the first frame.
    Yes, that looks real good. My main point was that blankclip is a pain for me because I almost always have trouble joining the blankclip with the video. Anything can cause incompatibility - frame rate, size, colorspace, audio properties. That's why I like 'loop' better.


    Darryl
    Quote Quote  
  20. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by dphirschler View Post
    blankclip is a pain for me because I almost always have trouble joining the blankclip with the video. Anything can cause incompatibility - frame rate, size, colorspace, audio properties.
    The secret there is to use the clip argument to make the BlankClip compatible with whatever you need.

    BlankClip(c, 100)
    will make a blank clip with all the same properties as clip 'c', except it will have length of 100 frames.
    Quote Quote  



Similar Threads

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