VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    Jan 2007
    Location
    Italy
    Search Comp PM
    I have a video device which gets 4 video inputs and gives one single output made up of a sequence of the 4 inputs, 2 seconds per each one.

    Does it exist a SW which can separate the 4 inputs and show them on the monitor at the same time? For example a virtualdub plugin?

    Is it complex to write a VD plugin? I'm a VB developer...
    -- Jumpjack --
    Quote Quote  
  2. AviSynth could do it. But there would have to be exactly the same number of frames in the sequences, throughout the video. See SelectEveryRange(), StackHorizontal(), and StackVertical(). For example, with 30 fps material and 2 second segments (ie, 60 frames per segment):

    src = WhateverSource("filename.ext")
    a = SelectEveryRange(240, 60, 0)
    b = SelectEveryRange(240, 60, 60)
    c = SelectEveryRange(240, 60, 120)
    d = SelectEveryRange(240, 60, 180)
    StackVertical( StackHorizontal(a,b),StackHorizontal(c,d))
    Last edited by jagabo; 30th Mar 2010 at 16:36.
    Quote Quote  
  3. Member
    Join Date
    Nov 2009
    Location
    United States
    Search Comp PM
    Using avisynth you can use this function:

    Code:
     
    vid = AVISource("input.avi")
    Quad(vid, 24, 2)
    
    Function Quad(clip v, float fps, int seconds)
    {
     every = fps * seconds
     ul = SelectRangeEvery(v, every, every, 0)
     ur = SelectRangeEvery(v, every, every, every)
     ll = SelectRangeEvery(v, every, every, every * 2)
     lr = SelectRangeEvery(v, every, every, every * 3)
     up = stackhorizontal(ul,ur)
     dn = stackhorizontal(ll,lr)
     return stackvertical(up,dn)
    }
    In Quad the 24 should be changed to the frames per second of your video clip. The 2 is the number of seconds of each sequence.
    Quote Quote  
  4. Member
    Join Date
    Jan 2007
    Location
    Italy
    Search Comp PM
    Can this be done in real time, rather than on an AVI file?

    And can be avisynth controlled by an external application?
    -- Jumpjack --
    Quote Quote  
  5. Originally Posted by jumpjack View Post
    Can this be done in real time, rather than on an AVI file?
    It's possible to use a GraphEdit capture graph as the source in AviSource(). I've done this to view live video with AviSynth filtering. I don't know if this exact script will work with a live source though -- because different parts of the final picture come from different points in time in the original video stream.

    Originally Posted by jumpjack View Post
    And can be avisynth controlled by an external application?
    AviSynth only works in the background. It requires that you use some other program to do the actual display or saving of the video. But the program can't modify AviSynth's behavior as it's running. For example, you won't be able to switch between a normal display and a quad display.

    You should also keep in mind that this will create an frame that is twice the horizontal and vertical dimensions of the source. If your source is 720x480 you will end up with a 1440x960 image. You can reduce that back to 720x480 by adding a resize filter before or after stacking. Before stacking:

    a = SelectEveryRange(240, 60, 0).BilinearResize(360,240)
    b = SelectEveryRange(240, 60, 60).BilinearResize(360,240)
    c = SelectEveryRange(240, 60, 120).BilinearResize(360,240)
    d = SelectEveryRange(240, 60, 180).BilinearResize(360,240)
    or after stacking:

    StackVertical( StackHorizontal(a,b),StackHorizontal(c,d)).Bilinea rResize(720,480)
    Also, doing all this in realtime may require a powerful computer.
    Quote Quote  
  6. Member
    Join Date
    Jan 2007
    Location
    Italy
    Search Comp PM
    Originally Posted by jagabo View Post
    Also, doing all this in realtime may require a powerful computer.
    I don't need audio, and 10-15 FPS would be enough for my application, so maybe this is not an issue.
    -- Jumpjack --
    Quote Quote  
  7. Member
    Join Date
    Jan 2007
    Location
    Italy
    Search Comp PM
    Originally Posted by jagabo View Post

    You should also keep in mind that this will create an frame that is twice the horizontal and vertical dimensions of the source. If your source is 720x480 you will end up with a 1440x960 image. You can reduce that back to 720x480 by adding a resize filter before or after stacking. Before stacking:

    a = SelectEveryRange(240, 60, 0).BilinearResize(360,240)
    b = SelectEveryRange(240, 60, 60).BilinearResize(360,240)
    c = SelectEveryRange(240, 60, 120).BilinearResize(360,240)
    d = SelectEveryRange(240, 60, 180).BilinearResize(360,240)
    or after stacking:
    I've not yet much clear AviSynth sintax: how can I resize the multiplexed video BEFORE demultiplexing it? It should require less computing power.
    -- Jumpjack --
    Quote Quote  
  8. Originally Posted by jumpjack View Post
    I've not yet much clear AviSynth sintax: how can I resize the multiplexed video BEFORE demultiplexing it? It should require less computing power.
    Ah yes, of course you could do that:

    src = AviSource("filename.avi").BilinearResize(360,240)
    There are also errors in the script I posted earlier. I just made one that works with an AVI file as the source:

    src=AviSource("filename.avi").BilinearResize(360,2 40)
    a = SelectRangeEvery(src,240, 60, 0)
    b = SelectRangeEvery(src,240, 60, 60)
    c = SelectRangeEvery(src,240, 60, 120)
    d = SelectRangeEvery(src,240, 60, 180)
    StackVertical( StackHorizontal(a,b),StackHorizontal(c,d))
    But doesn't work with a live capture from my PVR-250:

    src=DirectShowSource("capture.grf", audio=false, fps=29.97, framecount=99999).BilinearResize(360,240)
    a = SelectRangeEvery(src,240, 60, 0)
    b = SelectRangeEvery(src,240, 60, 60)
    c = SelectRangeEvery(src,240, 60, 120)
    d = SelectRangeEvery(src,240, 60, 180)
    StackVertical( StackHorizontal(a,b),StackHorizontal(c,d))
    Here's the capture graph:

    Click image for larger version

Name:	graph.png
Views:	554
Size:	11.6 KB
ID:	1117

    The media player or editor crashes when opening the AVS script. The same graph and a simple DirectShowSource("capture.grf", audio=false, fps=29.97, framecount=99999).BilinearResize(360,240) works fine.

    I'm not exactly sure, but I think this doesn't work because AviSynth needs to seek within the frames to SelectRangeEvery(). That's no problem with a file but with a capture the future frames don't exist. There may be a way around this with the Animate() or ApplyRange() filters. But you'll have to find someone who knows how to use those filters better than me!
    Last edited by jagabo; 31st Mar 2010 at 09:54.
    Quote Quote  
  9. Member
    Join Date
    Jan 2007
    Location
    Italy
    Search Comp PM
    Originally Posted by jagabo View Post
    [

    I'm not exactly sure, but I think this doesn't work because AviSynth needs to seek within the frames to SelectRangeEvery(). That's no problem with a file but with a capture the future frames don't exist. There may be a way around this with the Animate() or ApplyRange() filters. But you'll have to find someone who knows how to use those filters better than me!
    doesn'tit exist in Avisynth any kind of sleep() function to pause the program for some milliseconds?

    and what about interfacing Avisynth to the world? I'm not sure my device timing is very precise, so I guess I'll eventually get out of synch, hence I was thinking about controlling the device through the serial port, to tell it when to switch channel exactly (it has a manual swithcing button).
    Does avisynth have kind of an exec() or run() function to run external applications, so I could write an external application to control the serial port?
    -- Jumpjack --
    Quote Quote  
  10. You can create your own AviSynth filters. I don't know if you'll be able to do what you want within that context though.
    Quote Quote  



Similar Threads

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