Search code examples
audioavisynth

avisynth "transparent" overlaying audio


How overlay audio onto other audio? I want to make a FadeIO(..) feature for audio channels of clips in avisynth. I have this script

video = DirectShowSource("Z:\video\vvv.mp4", fps=fps_count, audio=true, convertfps=true).AssumeFPS(fps_count, 1).ConvertToYV12()
audio = BlankClip(audio_rate=audio_sample_rate, channels=2, length = logo_timeout).ResampleAudio(audio_sample_rate)

blank = BlankClip(logo_timeout, res_width, res_height, pixel_type = "RGB32", fps = fps_count).ConvertToYV12()
blank = Overlay(blank, blank_logo, mode = "blend", x = 0, y = 0)
blank = AudioDub(blank, blank_logo).AssumeFPS(fps_count, 1)

And smooth overlaying of parts of videos is like this:

blank.Trim(0 * fps_count, transparent_overlay_latency * fps_count).Overlay(video.Trim(0 * fps_count, transparent_overlay_latency * fps_count), mode="blend", mask=logo.showalpha(), x = 0, y = 0) 

But this works only for videos. The audio starts when second clip (video.Trim()) is already faded In. I want the sound of this video "grows up" , when the clip appears.


Solution

  • As the @SeedManc said in commentary under question:

    avisynth.nl/index.php/Dissolve, it allows for gradual transition between two clips, both in terms of video and audio.

    This method is very simple and is the answer for my question