VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Does AviSynth allow editing multiple clips? I am adding two audios to a video and I want to merge after audio trimming each of them. Also, I want to delay each audio. I tried doing it, but it seems like it's not working. Only one audio had a sound and the second audio was mute.
    Quote Quote  
  2. Originally Posted by jseo13579 View Post
    Does AviSynth allow editing multiple clips?
    Yes.

    Originally Posted by jseo13579 View Post
    I am adding two audios to a video and I want to merge after audio trimming each of them. Also, I want to delay each audio. I tried doing it, but it seems like it's not working. Only one audio had a sound and the second audio was mute.
    You did something wrong. Post your script.
    Quote Quote  
  3. Image
    [Attachment 49667 - Click to enlarge]
    . Here. I'm trying to have each of them trimmed and delayed separately.
    Quote Quote  
  4. Copy/paste the text of the script. I'm not going to retype the whole thing from an image.

    But from just a quick look, what are you trying to do with this line?

    Code:
    Video = DelayAudio(Video, 13.8) + DelayAUdio(Video, 342)
    That's appending two copies of the Video stream, one with the Audio delayed by 13.8 seconds and the other delayed by 342 seconds. Was it your intention to display the video twice?
    Last edited by jagabo; 28th Jul 2019 at 13:16.
    Quote Quote  
  5. Video = LSMASHVideoSource("C:\AviSynth Videos\Tekken 4 - Tekken Force - Kazuya - Ultra Hard.mp4")
    Audio = LWLibavAudioSource("C:\AviSynth Videos\Tekken 4 Laboratory Theme.mp3") + LWLibavAudioSource("C:\AviSynth Videos\Tekken 2 Kuma Theme.mp3")
    Audio = UnalignedSplice(AudioTrim(Audio, 0.5, 322.720), AudioTrim(Audio, 1040, 1574.5))
    Video = AudioDub(Video, Audio)
    Video = DelayAudio(Video, 13.8) + DelayAudio(Video, 342)
    Video = ConvertToYV12(Video)
    Video = Crop(Video, 42, 24, -70, -30)
    Video = EdgeFixer_ContinuityFixer(Video, left=10, top=0, right=0, bottom=0, radius=0)
    Video = FineDehalo(Video, rx=2, ry=2)
    Video = ChromaShiftSP(Video, x=0.5, y=0.5)
    Video = Rainbow_Smooth(video, radius=3)
    Return video

    No. I'm not displaying the video twice, just once. What I mean is that I want to delay each audio. For instance, I would like my first audio to play at 13.8 seconds and my second audio to play at 342 seconds of the video. Also, I want to make sure each audio is trimmed as I've tried and I'm not sure if I even did that correctly. I want to put two short audios together in one video.
    Quote Quote  
  6. You know, you can return any intermediate clip to verify that it contains what you want? The script does what I would expect it to do, and what the documentation says the functions do. You may also find it easier to deal with multiple named clips where you can check each clip individually. Logically, something like:

    Code:
    # Get source video and audio
    Video = LSMASHVideoSource("C:\AviSynth Videos\Tekken 4 - Tekken Force - Kazuya - Ultra Hard.mp4")
    Audio = LWLibavAudioSource("C:\AviSynth Videos\Tekken 4 Laboratory Theme.mp3") + LWLibavAudioSource("C:\AviSynth Videos\Tekken 2 Kuma Theme.mp3")
    
    # build first clip's video and audio
    V1 = Video.Trim(0,???)
    A1 = AudioTrim(Audio, 0.5, 322.720)
    V1 = AudioDub(V1, A1).AudioDelay(???)
    # return(V1) # if you need to check it
    
    # build second clip's video and audio
    V2 = Video.Trim(???, ???)
    A2 = AudioTrim(Audio, 1040, 1574.5)
    V2 = AudioDub(V2, A2).AudioDelay(???)
    # return(V2) # if you need to check it
    
    # join the two clips together, keeping A/V sync
    return(V1 ++ V2)
    I left some of the numbers from your original script though I have no idea if they are what you really want.
    Last edited by jagabo; 28th Jul 2019 at 21:15.
    Quote Quote  
  7. Video = LSMASHVideoSource("C:\AviSynth Videos\Tekken 4 - Tekken Force - Kazuya - Ultra Hard.mp4")
    Audio = LWLibavAudioSource("C:\AviSynth Videos\Tekken 4 Laboratory Theme.mp3") + LWLibavAudioSource("C:\AviSynth Videos\Tekken 2 Kuma Theme.mp3")
    Video = ConvertToYV12(Video)
    Video = Crop(Video, 42, 24, -70, -30)
    Video = EdgeFixer_ContinuityFixer(Video, left=10, top=0, right=0, bottom=0, radius=0)
    Video = FineDehalo(Video, rx=2, ry=2)
    Video = ChromaShiftSP(Video, x=0.5, y=0.5)
    Video = Rainbow_Smooth(video, radius=3)
    V1 = Trim(Video, 346, 8389)
    A1 = AudioTrim(Audio, 0.5, 322.720)
    V1 = AudioDub(V1, A1)
    V1 = DelayAudio(Video, 13.8)
    V2= Trim(Video, 8570, 21936)
    A2 = AudioTrim(Audio, 1040, 1574.5)
    V2 = AudioDub(V2, A2)
    V2 = DelayAudio(Video, 342)
    Return (V1 ++ V2)

    I don't hear any sound
    Quote Quote  
  8. Because

    Code:
    V1 = DelayAudio(Video, 13.8)
    is discarding the V1 clip you built on the three lines before it. Same with V2 = AudioDub(V2, A2).
    Quote Quote  
  9. I understand. I am supposed to make separate clips for each different audios I need to put in. That makes much more sense now. I was supposed to not put DelayAudio code into each clip. Thanks again for your help. I cannot thank you enough for so much help.
    Quote Quote  
  10. Originally Posted by jseo13579 View Post
    I understand. I am supposed to make separate clips for each different audios I need to put in.
    You don't have to do it that way. It's just easier to keep things straight.

    Another thing that helps you keep track of what you're doing is to use whitespace to delineate different logical sections:

    Code:
    Video = LSMASHVideoSource("C:\AviSynth Videos\Tekken 4 - Tekken Force - Kazuya - Ultra Hard.mp4")
    Audio = LWLibavAudioSource("C:\AviSynth Videos\Tekken 4 Laboratory Theme.mp3") + LWLibavAudioSource("C:\AviSynth Videos\Tekken 2 Kuma Theme.mp3")
    
    Video = ConvertToYV12(Video)
    Video = Crop(Video, 42, 24, -70, -30)
    Video = EdgeFixer_ContinuityFixer(Video, left=10, top=0, right=0, bottom=0, radius=0)
    Video = FineDehalo(Video, rx=2, ry=2)
    Video = ChromaShiftSP(Video, x=0.5, y=0.5)
    Video = Rainbow_Smooth(video, radius=3)
    
    V1 = Trim(Video, 346, 8389)
    A1 = AudioTrim(Audio, 0.5, 322.720)
    V1 = AudioDub(V1, A1)
    V1 = DelayAudio(V1, 13.8)
    
    V2= Trim(Video, 8570, 21936)
    A2 = AudioTrim(Audio, 1040, 1574.5)
    V2 = AudioDub(V2, A2)
    V2 = DelayAudio(V2, 342)
    
    Return (V1 ++ V2)
    And adding comments helps if you ever need to come back to a script in the future.
    Last edited by jagabo; 30th Jul 2019 at 11:09.
    Quote Quote  
  11. Is it possible to add audios on top of another?
    Quote Quote  
  12. You mean like the way an mkv file can have two separate stereo audio tracks that you switch between while playing? No. AviSynth can only output one audio track. But you can merge multiple channels into that track with MergeChannels(). So four channels from two stereo tracks can be merged into one quad track. Then when you encode you can merge the first pair into one stereo track, the second pair into another. If StereoA and StereoB are two stereo audio tracks:

    Code:
    MergeChannels(StereoA.GetChannel(1), StereoA.GetChannel(2) ,StereoB.GetChannel(1), StereoB.GetChannel(2))
    Quote Quote  
  13. Or did you mean mix 2 audio tracks to combine into one ?
    http://avisynth.nl/index.php/MixAudio
    Quote Quote  



Similar Threads

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