VideoHelp Forum
+ Reply to Thread
Results 1 to 15 of 15
Thread
  1. Hi everyone,
    I heard that some people use a AVS script to compare two videos and synchronize them by matching them, then they save and work the audio track.
    Can anyone tell me which script to use, please?
    Thanks
    Quote Quote  
  2. With the script I was able to compare the two videos but I don't know how to calculate the frame difference, does anyone have a video guide, please?
    Quote Quote  
  3. Open a script like this in VirtualDub:

    Code:
    v1 = LWlibavVideoSource("video1.ext").ShowFrameNumber()
    v2 = LWlibavVideoSource("video2.ext").ShowFrameNumber()
    StackHorizontal(v1, v2)
    Subrtact the frame numbes.
    Quote Quote  
  4. Originally Posted by jagabo View Post
    Open a script like this in VirtualDub:

    Code:
    v1 = LWlibavVideoSource("video1.ext").ShowFrameNumber()
    v2 = LWlibavVideoSource("video2.ext").ShowFrameNumber()
    StackHorizontal(v1, v2)
    Subrtact the frame numbes.
    I copied the text and saved in .avs file this VirtualDub error
    Image
    [Attachment 59427 - Click to enlarge]


    in AvsPmod.exe i am using this script

    a=DSS2("C:\video\file1.mkv").blackmanresize(688,49 6)
    b=DSS2("C:\video\file2.mkv").blackmanresize(688,49 6)
    finala=Trim(a,0,0)
    finalb=Trim(b,0,0)
    Stackhorizontal(finala, finalb)

    but then I don't know how to go on
    Quote Quote  
  5. You have to install the LSMASH source plugin to use LWlibavVideoSource(). Since you have DSS2() working you can just use that.

    Find some identifiable frame near the start of the video -- as shot change, a spot on the film, whatever. Identify which frame it is in each video. Calculate the difference, then add that to one of your trims. For example, if the identified frame is at frame 100 in video A, but at 110 in video b, the difference is 10 frames. So remove 10 frames from the beginning of video B:

    Code:
    a=DSS2("C:\video\file1.mkv").blackmanresize(688,49 6)
    b=DSS2("C:\video\file2.mkv").blackmanresize(688,49 6)
    finala=Trim(a,0,0)
    finalb=Trim(b,10,0)
    Stackhorizontal(finala, finalb)
    Reload the script and verify the two are now synced at frame 100. Check the rest of the video to see if they remain in sync. They probably won't. In which case it gets much more complicated.
    Quote Quote  
  6. Originally Posted by jagabo View Post
    You have to install the LSMASH source plugin to use LWlibavVideoSource(). Since you have DSS2() working you can just use that.

    Find some identifiable frame near the start of the video -- as shot change, a spot on the film, whatever. Identify which frame it is in each video. Calculate the difference, then add that to one of your trims. For example, if the identified frame is at frame 100 in video A, but at 110 in video b, the difference is 10 frames. So remove 10 frames from the beginning of video B:

    Code:
    a=DSS2("C:\video\file1.mkv").blackmanresize(688,49 6)
    b=DSS2("C:\video\file2.mkv").blackmanresize(688,49 6)
    finala=Trim(a,0,0)
    finalb=Trim(b,10,0)
    Stackhorizontal(finala, finalb)
    Reload the script and verify the two are now synced at frame 100. Check the rest of the video to see if they remain in sync. They probably won't. In which case it gets much more complicated.
    After I find the frame of video A I can't figure out how to see the frame of video B because they move together and I can't remember exactly the frame.
    It would be great if you could stop the frame of Video A and slide only Video B so as to compare the same frames and calculate the difference.
    I hope I have explained
    Reload the script and verify the two are now synced at frame 100. Check the rest of the video to see if they remain in sync. They probably won't. In which case it gets much more complicated.
    Quote Quote  
  7. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    This is where a script-based tool, such as AVISynth, is vastly inferior to gui-based NLEs. Using those, you just cut & slide the appropriate layer (having temp preset the layers to be 50%opacity), working your way through the video in near-realtime. You would be done by now.


    Scott
    Quote Quote  
  8. Originally Posted by Cornucopia View Post
    This is where a script-based tool, such as AVISynth, is vastly inferior to gui-based NLEs. Using those, you just cut & slide the appropriate layer (having temp preset the layers to be 50%opacity), working your way through the video in near-realtime. You would be done by now.


    Scott
    Do you have a guide or even better a tutorial video, please?
    Quote Quote  
  9. Originally Posted by Donnje View Post
    After I find the frame of video A I can't figure out how to see the frame of video B because they move together and I can't remember exactly the frame.
    Open the 2 videos videos in two VDubs (or 2 VDub2s, no need for a script then). Find the 'marker' frame in one and then adjust the 2nd video until you find it again. Note the frame numbers at the bottom of the VDubs.

    Or write down the frame numbers that you can't seem to remember.
    Quote Quote  
  10. Originally Posted by manono View Post
    Originally Posted by Donnje View Post
    After I find the frame of video A I can't figure out how to see the frame of video B because they move together and I can't remember exactly the frame.
    Open the 2 videos videos in two VDubs (or 2 VDub2s, no need for a script then). Find the 'marker' frame in one and then adjust the 2nd video until you find it again. Note the frame numbers at the bottom of the VDubs.

    Or write down the frame numbers that you can't seem to remember.
    Perfect, nice advice
    So if I understand correctly I have to use the trim or add black frames. When I have finished with the video sync how do I proceed to work the audio file? In the sense how and what video data should I export?
    Quote Quote  
  11. I have no idea what you're wanting to do so I have no advice.

    If you want to delay the audio by the amount of the frame difference between the 2 videos, then figure out that frame difference in milliseconds and DelayAudio by the same amount.
    Quote Quote  
  12. Originally Posted by manono View Post
    I have no idea what you're wanting to do so I have no advice.

    If you want to delay the audio by the amount of the frame difference between the 2 videos, then figure out that frame difference in milliseconds and DelayAudio by the same amount.
    I often have HD videos with foreign language audio and tvrip with ITA audio so I do the mux working on the two audio tracks while now I wanted to learn how to make the MUX working with the video tracks and I am looking for the easiest and fastest procedure
    Quote Quote  
  13. Again, I have no idea what you're doing. Maybe someone else can help.
    Quote Quote  
  14. Originally Posted by Donnje View Post
    I often have HD videos with foreign language audio and tvrip with ITA audio
    Your script in post #4 will sync audio as well as video at the start. But sources like that you will likely find the sync goes off again after a short while.
    Last edited by jagabo; 14th Jun 2021 at 21:56.
    Quote Quote  
  15. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Again, I have no idea what you're doing. Maybe someone else can help.
    I suppose he wants to mux a better video from source A with an italian audio from source B.
    The problem is that probably the 2 videos do not have the same lenght, because there can be different initial and end credits, different cuts, different black portions inside the programs, etc...
    To sync using avisynth is a nightmare, you have to go one small portion at the time removing/adding frames (sometimes in both of the clips).

    Just to give an example, I mixed a dvd video source with an audio tv capture and ended up with someting like this :

    Code:
    # aprire il video rai
    video_rai=AviSource("C:\Users\giuse\Videos\Acquisizioni\ufo_s1a_amtv.avi").killAudio()
    
    # aprire il video dvd
    video_dvd=AviSource("C:\Users\giuse\Videos\Acquisizioni\avs_scripts\gma\00e- match dvd\ufo_dvd_01_d2v_vfapi.avi").convertToYUY2()
    
    # sequenza video rai trimmata
    video_rai_trim=video_rai.trim(392,68937)
    
    # sequenza video dvd trimmata
     video_dvd_trim=\
     video_dvd.trim(  386,  655)+video_dvd.trim(  680,  735)+video_dvd.trim(  752,  864)+video_dvd.trim(  957,1155)+video_dvd.trim( 1172, 1393)\
    +video_dvd.trim( 1448, 1635)+video_dvd.trim( 1678, 1827)+video_dvd.trim( 1840, 1990)\
    	.loop(2,1990)\
    +video_dvd.trim (1991, 2004)+video_dvd.trim( 2031, 3846)+video_dvd.trim( 3863, 9230)+video_dvd.trim( 9250,9342)+video_dvd.trim(10181,10184)\
    +video_dvd.trim(10343,10535)+video_dvd.trim(10714,11694)+video_dvd.trim(11704,13489)\
    	.loop(2,13489)\
    +video_dvd.trim(13490,13490)\
    	.loop(3,13490)\
    +video_dvd.trim(13491,13803)+video_dvd.trim(14590,20535)+video_dvd.trim(22351,27286)\
    	.loop(2,27286)\
    +video_dvd.trim(27287,27369)\
    	.loop(3,27369)\
    +video_dvd.trim(27370,30237)\
    	.loop(15,30237)\
    +video_dvd.trim(30238,41522)\
    	.loop(28,41522)\
    +video_dvd.trim(41523,43640)\
    	.loop(2,43640)\
    +video_dvd.trim(43641,44914)\
    +video_dvd.trim(44917,45316)\
    	.loop(2,45316)\
    +video_dvd.trim(45317,46559)+video_dvd.trim(46561,46648)\
    	.loop(2,46648)\
    +video_dvd.trim(46649,47190)+video_dvd.trim(47192,50811)+video_dvd.trim(50819,53725)\
    	.loop(2,53725)\
    +video_dvd.trim(53726,53886)\
    	.loop(2,53886)\
    +video_dvd.trim(53887,63326)+video_dvd.trim(63451,64151)\
    	.loop(3,64151)\
    +video_dvd.trim(64152,64744)\
    	.loop(3,64744)\
    +video_dvd.trim(64745,64745)\
    	.loop(28,64745)\
    +video_dvd.trim(64746,68392)\
    	.loop(3,68392)\
    +video_dvd.trim(68393,68395)\
    	.loop(2,68395)\
    +video_dvd.trim(68396,71511)+video_dvd.trim(73570,73570).crop(0,0,-10,-20).addborders(10,20,0,0)\
    	.loop(1462,73570).crop(0,0,-10,-20).addborders(10,20,0,0)\
    ++video_dvd.trim(73861,73861)\
    	.loop(107,73861)
    
    # verifica allineamento sequenze
    #stackhorizontal(video_dvd_trim, video_rai_trim)
    
    ...........
    
    # estrazione audio da filmato rai
    #audio_rai=AviSource("C:\Users\giuse\Videos\Acquisizioni\ufo_s1a_amtv.avi").trim(392,68937).SoundOut()
    
    # doppiaggio video da filmato dvd e audio da filmato rai
    #video_dvd_trim_logo_titoli_audio_rai=audiodub(video_dvd_trim_logo_titoli, audio_rai)
    
    #return(video_dvd_trim_logo_titoli_audio_rai)
    using one VitualDub for source A, one VirtualDub for source B and a third VirtualDub for verification
    Last edited by lollo; 15th Jun 2021 at 18:28.
    Quote Quote  



Similar Threads

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