VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Hi there. I have two files that I need to join together, and then fade out at the beginning, then at the end. The issue here is that I have this script in AVISynth...

    Code:
    a = DirectShowSource("Epic2Lv3.avi")
    b = DirectShowSource("Epic2Lv4.avi")
    
    FadeIn(a,35)
    FadeOut(b,35)
    
    Dissolve(a,b,35)
    The problem is that I cannot get anything to render in VirtualDub as the rendering process refused to start. Any help would be great. I want to avoid using WMM as having the resulting video in WMV format will make it pretty difficult to burn in subtitles later in VirtualDub. Both videos are in Xvid format at 1152x720 at 35 frames per second. Both clips when loaded individually showed a warning that they have a non zero starting time.

    I can't even get the script to load a video using VLC or WMP.
    Quote Quote  
  2. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    That should render. But it probably doesn't do what you intend.

    The fades will be ignored as you then call the oriignal a and b in the Dissolve.

    Try this:
    Code:
    a = DirectShowSource("Epic2Lv3.avi").FadeIn(35)   
    b = DirectShowSource("Epic2Lv4.avi").FadeOut(35)    
    
    Dissolve(a,b,35)
    Both clips when loaded individually showed a warning that they have a non zero starting time.
    I would try to fix that first, by saving them through Avidemux, with video and audio set to "copy". That usually cleans up wacky files.
    Quote Quote  
  3. 1. remux the files to make sure you timestamps are okay otherwise "when loaded individually showed a warning that they have a non zero starting time." might cause problems.
    2. try something like:
    Code:
    a = AviSource("clip1.avi") //needs vfw decoders, alternatively use ffmpegsource or you really need DirectShowSource
    b = AviSource("clip2.avi") //needs vfw decoders, alternatively use ffmpegsource or you really need DirectShowSource
    af = FadeIn(a,35)
    bf = FadeOut(a,35)
    return Dissolve(af,bf,35)
    3. Why not add the subtitles directly in the avisynth script? (i.e. with TextSub, VobSub or if it's just a simple Text with Subtitle)

    ---

    AlanHK was faster
    Quote Quote  
  4. Originally Posted by AlanHK View Post
    That should render. But it probably doesn't do what you intend.

    The fades will be ignored as you then call the oriignal a and b in the Dissolve.

    Try this:
    Code:
    a = DirectShowSource("Epic2Lv3.avi").FadeIn(35)   
    b = DirectShowSource("Epic2Lv4.avi").FadeOut(35)    
    
    Dissolve(a,b,35)
    Both clips when loaded individually showed a warning that they have a non zero starting time.
    I would try to fix that first, by saving them through Avidemux, with video and audio set to "copy". That usually cleans up wacky files.
    That didn't fix anything, in fact, it just adds another truncated audio stream warning, but the script works. Rendering the script to a video file produces a video with severe desync issues. I'll try later to apply the script to the original files.
    Last edited by ArcheKruz; 28th Jul 2011 at 03:53.
    Quote Quote  
  5. Using dissolve changes the total frame count and accounts for the audio going out of synch (or being truncated). If, instead of a dissolve, you just fade out and then fade back in, the audio should stay in synch.
    Quote Quote  
  6. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by manono View Post
    Using dissolve changes the total frame count and accounts for the audio going out of synch (or being truncated). If, instead of a dissolve, you just fade out and then fade back in, the audio should stay in synch.
    Pure garbage! (as you might say, manono )

    Dissolve also cross-fades the audio, so sync is maintained.
    (And in fact, fades are implemented internally in Avisynth using Dissolve with a blank clip.)

    Before applying the script, the OP needs to fix the problems with the original files (eg with Avidemux as AlanHK suggests).
    Quote Quote  
  7. Oh, he mentioned (and I echoed) the audio being truncated. I figured it got truncated because he kept it in the script during the dissolve. So that's not true?

    I handle my audio separately and after using a dissolve the audio is no longer in synch. True, right? Because the frame count of the two clips and the dissolve is less than the frame counts of just the 2 clips added together, right? So I also figured he was at least attempting to correct the problem by adding the audio in afterwards.

    Anyway, thanks for the correction.
    Quote Quote  
  8. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by manono View Post
    I handle my audio separately and after using a dissolve the audio is no longer in synch. True, right? Because the frame count of the two clips and the dissolve is less than the frame counts of just the 2 clips added together, right?
    Yes, that's right. The total frame count is reduced by the amount of the overlap.
    If processing audio in the script, the audio is also cross-faded over the same amount of time, so it stays in sync.
    But if you process the audio separately, then the lengths will no longer match.

    In that case, as you suggest, it might be preferable to use a fade out and in instead of Dissolve.
    Be careful here too though, since you have to use the FadeOut0 and FadeIn0 variants, as normal FadeOut/In adds an extra frame.
    Quote Quote  
  9. The audio being truncated warning showed up when I loaded the Demuxed files individually into VDub. Like I said, AviDemux didn't fix the issue as AlanHK suggested, it just added another audio error on top of the nonzero video start time warning.
    Quote Quote  
  10. Originally Posted by Gavino View Post
    Be careful here too though, since you have to use the FadeOut0 and FadeIn0 variants, as normal FadeOut/In adds an extra frame.
    I always use the zero in my Fadein/outs. Have you guys thought about fixing that? That is a bug, right, or might be there be a reason someone would want to change the total frame count when using Fades? Yeah, I know that extra frame is added so there's a black frame at the beginning and/or end. But still, it shouldn't be all that hard to do the fade over n-1 frames, and then add the black frame so the total number of frames remains constant.
    Quote Quote  
  11. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by ArcheKruz View Post
    The audio being truncated warning showed up when I loaded the Demuxed files individually into VDub. Like I said, AviDemux didn't fix the issue as AlanHK suggested, it just added another audio error on top of the nonzero video start time warning.
    Avidemux has a few options that may straighten the file out.
    Audio/Build VBR Time map
    Tools/rebuild I & B frames

    If it then plays in Avidemux correctly, copy/save as before, to a new AVI file.

    In Avisynth, I always try AviSource() to source AVI files first.
    If that has problems, then FFmpegsource2() or finally DirectShowSource().
    To keep sync with VBR audio, use EnsureVBRMP3sync() (not needed for FFmpegsource2).

    Anyway, the script I gave before does work, I tried it. The problem is with your files.
    Quote Quote  
  12. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by manono View Post
    I always use the zero in my Fadein/outs. Have you guys thought about fixing that? That is a bug, right, or might be there be a reason someone would want to change the total frame count when using Fades? Yeah, I know that extra frame is added so there's a black frame at the beginning and/or end. But still, it shouldn't be all that hard to do the fade over n-1 frames, and then add the black frame so the total number of frames remains constant.
    The problem is once a function has been around for a while there are thousands of scripts that depend on it working that way.

    If it's necessary to keep the frame count, I do
    Trim(1,0).FadeIn(20)
    Often the first frame is wacky anyway and it saves me having to do
    FreezeFrame(0,1,1)
    Quote Quote  
  13. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by manono View Post
    I always use the zero in my Fadein/outs. Have you guys thought about fixing that? That is a bug, right, or might be there be a reason someone would want to change the total frame count when using Fades? Yeah, I know that extra frame is added so there's a black frame at the beginning and/or end. But still, it shouldn't be all that hard to do the fade over n-1 frames, and then add the black frame so the total number of frames remains constant.
    I don't know if this was a bug (ie unintended) or simply a badly conceived design, but as AlanHK says, changing it now would alter the behaviour of existing scripts and the Avisynth developers strive to maintain backwards compatibility. I guess that's why FadeIn0, etc, were introduced in v2.56 (although they don't quite do what your suggested fix would, since they don't have a completely black frame).

    Originally Posted by AlanHK View Post
    If it's necessary to keep the frame count, I do
    Trim(1,0).FadeIn(20)
    Of course, you have to remember that this effectively gives a 21-frame fade.
    A 20-frame fade out, ending on black, is a bit more cumbersome:
    Trim(0,Framecount-2).FadeOut(19)
    Quote Quote  



Similar Threads