VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. What I want to do is replace the audio in a certain scene with the audio from a previous point in the clip.


    DirectshowSource("HD.wmv", FPS=29.97, ConvertFPS=True)+DirectShowSource("2HD.wmv", FPS=29.97, ConvertFPS=True)

    Trim(43733,43799)+Trim(41992,42389)

    Yes, I know that those trims are out of order. What I'd like to do is replace the audio in the first clip with the audio in the second, but still have the video play. I'm hoping there is something I can insert in between the trims.
    Quote Quote  
  2. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    http://avisynth.nl/index.php/AudioDub

    FWIW --- FMSS2 is preferable to DirectShowSource when you need to use Trim(), but
    if you prefer DSS anyway, at least don't forget to call

    http://avisynth.nl/index.php/EnsureVBRMP3Sync
    Quote Quote  
  3. Using FFVideoSource means I won't have sound though right? And Audiodub means I would have to make a seperate audio file of the entire clip just to have any audio at all. That's the main reason why I use DirectShowSource.

    I guess I'm stuck with audiodub then. Thank you for your help.
    Quote Quote  
  4. You can use MixAudio() to mix the audio from t1 and t2, just specify 0 volume for the audio in t1.
    Code:
    t1=Trim(...)
    t2=Trim(.)
    t1=MixAudio(t1,t2,0.0,1.0) # 0.0 parts t1 audio, 1.0 parts t2 audio
    t1+t2
    Last edited by jagabo; 1st Apr 2014 at 22:00.
    Quote Quote  
  5. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by smike View Post
    Using FFVideoSource means I won't have sound though right? And Audiodub means I would have to make a seperate audio file of the entire clip just to have any audio at all.
    Incorrect, because there exists FFAudioSource()
    Quote Quote  
  6. MixAudio works good too, thank you.

    As for the FFAudioSource, every time I've tried to use that, it cancels out FFVideoSource, and just gives me audio. I cannot use both at the same time.
    Quote Quote  
  7. Originally Posted by smike View Post
    As for the FFAudioSource, every time I've tried to use that, it cancels out FFVideoSource, and just gives me audio. I cannot use both at the same time.
    Use named streams:

    Code:
    aud=ffAudioSource("filename.ext") # audio first
    vid=ffVideoSource("filename.ext") # then video
    AudioDub(vid,aud) # join vid and audio together, if you need to
    Or use FFmpegSource2("filename.ext", atrack=#) which does that automatically for you.

    When you don't specify a name for a stream AviSynth will assume "last". So a sequence like

    Code:
    ffAudioSource("filename.ext")
    ffVideoSource("filename.ext")
    really means:

    Code:
    last=ffAudioSource("filename.ext")
    last=ffVideoSource("filename.ext")
    So the call to ffVideoSource ends up throwing away the result of ffAudioSource.
    Quote Quote  
  8. Alright, I've been pounding away on this and I almost have it:


    AudioDub(FFVideoSource("HD.wmv", fpsnum = 30000, fpsden = 1001), FFAudioSource("HD.wmv"))Trim(0,41988)++AudioDub(FF VideoSource("2HD.wmv", fpsnum = 30000, fpsden = 1001) , FFAudioSource("HD.wmv"))Trim(707,773)

    How exactly can I get this to combine? I tried combining the Audiodubs but it only plays that very last short trim, with the alternate audio I wanted.


    As for that, I got the video trimmed fine, but the audio isn't synced up with the part I wanted in the first clip. Would I have to specify a trim for the audio as well?
    Quote Quote  
  9. When using ffVideoSource() and ffAudioSource() on the same file you must call ffAudioSource() first, or you must build an index first.

    I'm pretty sure you script will leave you with only 67 frames from HD.WMV. If your intent was to concatenate frames 707-773 of 2HD.WMV onto frames 0-41988 of HD.WMV you should add a . (pipe) between the AudioDub() and Trim() functions. Otherwise that final trim will apply to the joined videos, not only the last video.

    As written you script means

    Code:
    AudioDub()
    Trim() ++ AudioDub() # trim the results of AudioDub1 and add AudioDub2
    Trim() # trim the entire joined clip
    Whereas what you want is:

    Code:
    AudioDub().Trim()++AudioDub().Trim()
    Which pipes AudioDub1 directly to Trim1, and pipes AudioDub2 directly to trim2, and adds them together.
    Quote Quote  
  10. Ah, okay I fixed that.

    AudioDub(FFAudioSource("HD.wmv"), FFVideoSource("HD.wmv", fpsnum = 30000, fpsden = 1001))
    #Trim(0,41988)++AudioDub(FFAudioSource("HD.wmv"), FFVideoSource("2HD.wmv", fpsnum = 30000, fpsden = 1001)).Trim(707,773)

    Yes, I understand i have only 67 frames or so in that second trim from 2HD.

    I was hoping to trim down the audio from HD.wmv so it matches up.

    (707,773) is the video trim. However the audio trim from HD2 takes place (41992,42500). I'll trim it down of course. I hope it's possible to place that trim somewhere so it maches up.
    Quote Quote  
  11. I have no idea what you are trying to do at this point. Your latest script does nothing more than loads all the audio and video from HD.WMV. Maybe you should restate exactly what you are trying to do in plain english.
    Quote Quote  
  12. It loads the video from HD.wmv and then goes into 2HD, but plays 2 seconds of the audio from the first clip. However,I want that audio to not be synced up with the trimmed video. I want a completely different section of audio to play. Right now I'm assuming this isn't exactly possible to do, so maybe it's best I should make a wav file and sync it up that way.
    Quote Quote  
  13. Originally Posted by smike View Post
    It loads the video from HD.wmv and then goes into 2HD, but plays 2 seconds of the audio from the first clip. However,I want that audio to not be synced up with the trimmed video. I want a completely different section of audio to play. Right now I'm assuming this isn't exactly possible to do, so maybe it's best I should make a wav file and sync it up that way.
    You need to make two trims of the second video. One with the video you want, the other with the audio you want. Then use MixAudio() to mix the audio of those two trims (0 weighting on one, 1 weighting on the other). Finally, add that the the trim from the first clip. Something like:
    Code:
    hd1=AudioDub(FFmpegSource2"HD.wmv", atrack=2, fpsnum=30000, fpsden=1001) # audio and video from HD.WMV
    hd2=AudioDub(FFmpegSource2"HD2.wmv", atrack=2, fpsnum=30000, fpsden=1001) # audio and video from HD2.WMV
    
    t1=hd2.Trim(707,773) # the video you want from hd2
    t2=hd1.Trim(41992,42058) the extra audio you want from hd1 (same length as t1)
    
    hd1.Trim(0,41988)++MixAudio(t1, t2, 0, 1)
    Last edited by jagabo; 8th Apr 2014 at 16:48.
    Quote Quote  
  14. Ah, got it now. Thank you so much for all your help.
    Quote Quote  



Similar Threads

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