VideoHelp Forum




+ Reply to Thread
Results 1 to 18 of 18
  1. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    I have three videos, only two have the same image dimensions. I can playback these two videos synchronized using AviSynth:

    Code:
    clip1 = DirectShowSource("leftVideo.avi", audio=false)
    clip2 = DirectShowSource("rightVideo.avi", audio=false)
    
    StackHorizontal(clip1,clip2)
    Now, the third video actually has the audio I want to play, and has a different format and dimension from the first two. I can play one of the first two videos with the third video's audio like this:

    Code:
    Video=AVISource("leftVideo.avi")
    Audio=AVISource("thirdVideo.avi")
    AudioDub(Video,Audio)
    My question is: How can I play all three videos at once, with the first two videos (leftVideo, rightVideo) stacked horizontally above, and have the third video show both video and audio centered below the horizontal stack?

    Bonus: Is there a way to show the third video (audio and video) stacked constantly on the left, and manipulate the right video to toggle between the other two videos (via hotkey)?

    Thanks in advance!
    Quote Quote  
  2. clip1 = DirectShowSource("leftVideo.avi", audio=false)
    clip2 = DirectShowSource("rightVideo.avi", audio=false)
    clip3 = AVISource("thirdVideo.avi").AddBorders(whatever is necessary to make the width the same size as the the first two videos stacked horizontally)

    AudioDub(StackVertical(StackHorizontal(clip1,clip2 ), clip3), clip3)
    For example, if the three videos are 640x480:

    clip1 = DirectShowSource("leftVideo.avi", audio=false)
    clip2 = DirectShowSource("rightVideo.avi", audio=false)
    clip3 = AVISource("thirdVideo.avi").AddBorders(320,0,320,0 )

    AudioDub(StackVertical(StackHorizontal(clip1,clip2 ), clip3), clip3)
    DirectShowSouce() may not be frame accurate and may deliver a different colorspace than AviSource(). I would use AviSource() for all three.
    Last edited by jagabo; 6th Nov 2010 at 06:25.
    Quote Quote  
  3. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    What do you suggest if the top two videos (no audio) are both 644 x 484 and the bottom video (with the audio) is 720 x 576 ?

    I'm trying this (below) but it doesn't work...


    Code:
    clip1 = AVISource("leftVideo.avi", audio=false)
    clip2 = AVISource("rightVideo.avi", audio=false)
    
    Audio = AVISource("audioVideo.avi").AddBorders(284, 0, 284, 0)
    
    StackVertical(StackHorizontal(clip1,clip2), Audio)
    Quote Quote  
  4. Note I adjusted my earlier post a bit. You script looks like it should work. I suspect DirectShowSource() is returning video with a different colorspace than AviSource(). Try using AviSource() for all three. If they are still in different colorspaces you'll have to force them to match. For example:

    clip1 = AviSource("leftVideo.avi", audio=false).ConvertToYV12()
    clip2 = AviSource("rightVideo.avi", audio=false).ConvertToYV12()
    clip3 = AVISource("thirdVideo.avi").AddBorders(284,0,284,0 ).ConvertToYV12()

    AudioDub(StackVertical(StackHorizontal(clip1,clip2 ), clip3), clip3)
    You don't have to use YV12. You could also use ConverToYUY2() or ConvertToRGB(), as long as all three are the same. If any of the source files is already the desired colorspace you don't have to convert it.
    Last edited by jagabo; 6th Nov 2010 at 06:36.
    Quote Quote  
  5. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    Looks great, thanks! But, the video is much slower than it should be, although the audio is fine. Is there any way to fix that?

    I'm noticing that the top two are XVID and the bottom one is DVSD....

    Thanks for your help!
    Last edited by oroboros74; 6th Nov 2010 at 06:49.
    Quote Quote  
  6. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    Originally Posted by jagabo View Post
    You don't have to use YV12. You could also use ConverToYUY2() or ConvertToRGB(), as long as all three are the same. If any of the source files is already the desired colorspace you don't have to convert it.
    Oddly enough, YV12 and YUY2 worked fine, but not RGB... I wonder why?
    Quote Quote  
  7. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    The problem seems to be the framerate, which I altered. Just to give you some practical context, the two videos are from high-speed cameras w/o audio (50fps) and the third is a DV camera (PAL, 25fps). This is how I forced it:

    Code:
    clip1 = DirectShowSource("leftVid.avi", audio=false, fps=25, ConvertFPS=True).ConvertToYUY2()
    clip2 = DirectShowSource("rightVid.avi", audio=false, fps=25, ConvertFPS=True).ConvertToYUY2()
    
    clip3 = DirectShowSource("audioVid.avi", fps=25, ConvertFPS=True).AddBorders(284, 0, 284, 0).ConvertToYUY2()
    
    AudioDub(StackVertical(StackHorizontal(clip1,clip2), clip3), clip3)
    By doing so, however, the video starts lagging behind after a little while.

    Any other suggestions?
    Quote Quote  
  8. what are your system specs ? maybe it's not fast enough to play 3 videos simulataneously ? open task manager and see if you are 100% loaded when playing
    Quote Quote  
  9. By "video starts lagging" you mean the video is playing more slowly than the audio? Are you just running out of horsepower? Two 50 fps clips and one 25 fps is a heavy workload for realtime playback.

    Try ChangeFPS() instead of ConvertFPS=True. It should be faster. AviSource() is more reliable than DirectShowSource(). With DV AVI that's usually not a problem but I don't know about the other clips.
    Quote Quote  
  10. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    Actually my CPU is only at 45-55%.

    Here's a screenshot of the videos' specs. Consider that the two high-speed cameras produce videos like on the left, and the DV camera's video is on the right.

    Size-wise, the high-speed camera videos are less than 10% each of the size of the DV, which never really exceeds a couple GBs (these are all very short clips).

    Click image for larger version

Name:	gspot.png
Views:	865
Size:	163.6 KB
ID:	4116

    Thanks again for your help on this!
    Quote Quote  
  11. what software are you using to playback?

    try mpc with renderer set to "overlay mixer"

    as suggested earlier try avisource instead of directshowsource ; multiple directshow calls might be problematic

    are the videos located on the same drive? is it defragged ?
    Quote Quote  
  12. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    Actually, using AviSource makes the problem worse than DirectShowSource() (?)

    I'm using GOM Player, but I tried just now with MPC and still nuthin'...

    If you see the original post, I don't have problems when I use two of the videos together (sync fine), the problem I have a feeling is because of the different format of the third video...
    Quote Quote  
  13. The problem could be with disk seeks -- three videos playing at the same time from three different places on the drive. As an experiment try playing the same file as clip1 and clip2. That way you're only reading two different videos. See if it's any smoother. Or put clip3 on a different drive than clip1 and clip2.
    Quote Quote  
  14. [edit]
    Quote Quote  
  15. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by oroboros74 View Post
    I have a feeling is because of the different format of the third video...
    I still think it's likely to be a 'horsepower' problem - after all, you are trying to put together and play in real time a video of 1288x1060. Does it work if you leave out one of the upper videos? Eg
    Code:
    clip1 = DirectShowSource("leftVid.avi", audio=false, fps=25, ConvertFPS=True).AddBorders(38, 0, 38, 0).ConvertToYUY2() # or clip2
    clip3 = DirectShowSource("audioVid.avi", fps=25, ConvertFPS=True).ConvertToYUY2()
    AudioDub(StackVertical(clip1, clip3), clip3)
    Quote Quote  
  16. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    OK! I think we're getting somewhere!

    Gavino's script works flawlessly (kudos!), but with two vids.

    jagobo, three vids work great when clip1 and clip2 are both the same video file; I tried placing one of the videos on a external hard drive and have it play from there, and it was still choppy.

    There are no problems in rendering three video files at once (as long as two are the same), and the CPU is only at 50% so help me understand: is it a problem with the HD having to seek three different files at once, or is it have to do more with the video card, or what?

    And at this point, is it safe to say that there's no way to run more than two videos contemporaneously? Or what would I need? (but see here: https://forum.videohelp.com/threads/258275-Two-Video-Clips-Side-by-Side)
    Quote Quote  
  17. Even though you're not seeing high CPU usage you may still be running out of CPU power. With video playback, when the CPU gets behind the player will attempt to seek forward in the file to skip past some frames (some players, depending on their settings, will just slow down the playback instead). This seeking takes time but doesn't show up as CPU usage in Task Manager. Add to that the fact that you're playing 3 files, two of which are at 50 fps, means you're putting a lot of stress on the CPU and disk drive(s). So you probably have a mixture of borderline CPU and disk performance. What CPU are you using? A dual core? Quad core?

    If you don't need realtime playback you can just open the AVS script in an editor and create a new video file. That way each frame is read from the source files and is passed to the output, no matter how long it takes. Then you can play the new video file alone.
    Quote Quote  
  18. Member
    Join Date
    Nov 2010
    Location
    Germany
    Search PM
    Thanks a lot for your help and that explanation. I will have to try with our other PC (my laptop is just a dual core), and maybe it works there. Otherwise it may just as well be useful to create a single video file.

    We have dozens of 3-minute clips which we need to analyze, but you guys certainly were of great help! Now I just need to figure out a way to automatize the process of creating all these scripts for all these clips (and if you guys have any last minute suggestions, they're very much appreciated!).

    Thanks again for your help! It's been a learning experience!
    Quote Quote  



Similar Threads

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