VideoHelp Forum
+ Reply to Thread
Results 1 to 21 of 21
Thread
  1. Hello, it would be great if someone could help me. I'm trying to edit an avi file with AviSynth and VirtualDub. If I open the avi directly in VDub, everything is fine. But when I play the same video via AviSynth in VDub, there is no audio. However, if I save a portion of it as avi, that avi does have audio, so apparently there is something wrong with the preview function.

    The problem occurs with a minimal script like

    AviSource("video.avi")

    and also if I save the audio as wav and put

    vid=AviSource("video.avi")
    aud=WAVSource("audio.wav")
    AudioDub(vid,aud)

    in the avs file. No audio in the VDub preview. Of course I could load the wav via VDub "Audio from other file", but this wouldn't help me because then the cutting I do in AviSynth would only affect the video. Can anyone help?
    Last edited by Sebastian2011; 11th Mar 2012 at 06:03.
    Quote Quote  
  2. Member
    Join Date
    Jan 2007
    Location
    NJ, United States
    Search Comp PM
    Hi, I open AviSynth scripts a lot in Vdub and never had your experience. Can you cut a small clip in Vdub and upload it so we can take a closer look?
    Quote Quote  
  3. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    In Vdub open the AVS and then do
    File/File information and see what it says about the audio.

    And also add info() to the script and see what Avisynth says.
    How many channels?

    Instead of Avisource, you can also use
    FFmpegSource2("video.avi",atrack=-1,fpsnum=-1,fpsden=1)
    or
    DirectShowSource("video.avi")

    These usually work if Avisource has a problem with audio.
    Quote Quote  
  4. Originally Posted by GideonK View Post
    Hi, I open AviSynth scripts a lot in Vdub and never had your experience. Can you cut a small clip in Vdub and upload it so we can take a closer look?
    Here it is. Something must be wrong with the audio. I worked around the problem in the meantime by saving the audio as wav and re-encoding it, but I'd still like to know what caused the problem.
    Image Attached Files
    Quote Quote  
  5. Originally Posted by AlanHK View Post
    In Vdub open the AVS and then do
    File/File information and see what it says about the audio.
    Info looks normal, uncompressed PCM.

    And also add info() to the script and see what Avisynth says.
    How many channels?
    It says 6 channels.

    Instead of Avisource, you can also use
    FFmpegSource2("video.avi",atrack=-1,fpsnum=-1,fpsden=1)
    or
    DirectShowSource("video.avi")

    These usually work if Avisource has a problem with audio.
    Interestingly, with FFMpegSource2, VDub says it finds no audio track. With DirectShowSource it works.
    Quote Quote  
  6. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    It opens and plays fine in VDub and AviDemux.
    Quote Quote  
  7. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    testcutvdub.avi
    Here is a test cut I did in VDub....outputted it to H264 and kept the original audio.
    Image Attached Files
    Quote Quote  
  8. Originally Posted by hech54 View Post
    testcutvdub.avi
    Here is a test cut I did in VDub....outputted it to H264 and kept the original audio.
    Thanks for everybody's efforts. Yes, opening it directly in VDub works fine for me too, trouble begins with AviSynth.

    Another strange observation: As I said, when I open that file with AviSynth (AviSource) and VDub, it doesn't play the audio. If I go ahead and replace the "AviSource" in my script by "DirectShowSource" and reload, the sound is there. If I change the script back to AviSource, it's still there! But only until I close and reopen VirtualDub, then it's silent again.

    So never mind and thanks again, it's just some kind of bug.
    Quote Quote  
  9. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by Sebastian2011 View Post
    It says 6 channels.
    That's the issue; I think it's just VDub isn't set up for multichannel playing.

    If you want to hear your clip, you can just do
    Code:
    AVISource("test.avi")
    GetChannel(3)
    which will give you Channel 3, the centre channel, voice in your clip.

    When you have your script done you can comment out the GetChannel and save the output as multichannel, even if you don't hear it in VDub.

    Or if you want to downmix 6 channels properly to stereo, use a function like
    Code:
    function Dmix6Dpl(clip a)
    {
      flr = GetChannel(a, 1, 2)
      fcc = GetChannel(a, 3, 3)
      lrc = MixAudio(flr, fcc, 0.3205, 0.2265)
      bl  = GetChannel(a, 5)
      br  = GetChannel(a, 6)
      sl  = MixAudio(bl, br, 0.2265, 0.2265)
      sr  = MixAudio(bl, br, -0.2265, -0.2265)
      blr = MergeChannels(sl, sr)
      return MixAudio(lrc, blr, 1.0, 1.0)
    }

    See
    http://avisynth.org/mediawiki/GetChannel
    and
    http://forum.doom9.org/showthread.php?p=1243880#post1243880


    Originally Posted by Sebastian2011 View Post
    If I go ahead and replace the "AviSource" in my script by "DirectShowSource" and reload, the sound is there.
    DirectShowSource uses your usual Windows codecs to play it, probably ffdshow.
    That will downmix it for you, if your PC is set up for stereo.
    Last edited by AlanHK; 11th Mar 2012 at 21:10.
    Quote Quote  
  10. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    ....or just drag the file into VDub and stop fvkking around with AviSynth when it isn't necessary.
    Quote Quote  
  11. Originally Posted by AlanHK View Post

    That's the issue; I think it's just VDub isn't set up for multichannel playing.
    Then why would loading the AVI directly with 6 channel audio play ?
    Quote Quote  
  12. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    Originally Posted by poisondeathray View Post
    Originally Posted by AlanHK View Post

    That's the issue; I think it's just VDub isn't set up for multichannel playing.
    Then why would loading the AVI directly with 6 channel audio play ?
    I didn't think it was either to be honest.
    Quote Quote  
  13. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    To downmix to 2-channel, I usually use directshowsource for 6-channel ac3.
    FFDshow's mixer does a very good 2-channel downmix.
    Quote Quote  
  14. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by AlanHK View Post

    That's the issue; I think it's just VDub isn't set up for multichannel playing.
    Then why would loading the AVI directly with 6 channel audio play ?
    Dunno why, but via Avisynth and VDub multi channel doesn't work, at least on my setup, and apparently the OP's.
    I downmix everything to stereo, since that's all I have anyway, so I don't really worry about it.
    Quote Quote  
  15. Originally Posted by AlanHK View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by AlanHK View Post

    That's the issue; I think it's just VDub isn't set up for multichannel playing.
    Then why would loading the AVI directly with 6 channel audio play ?
    Dunno why, but via Avisynth and VDub multi channel doesn't work, at least on my setup, and apparently the OP's.
    I downmix everything to stereo, since that's all I have anyway, so I don't really worry about it.
    Thanks a lot, that helped! Since the source is a DVD, I tried again to use .d2v and .ac3 out of DGIndex files via AviSynth, which resulted in the same problem. When I used GetChannel(3), I got audio, but the music was missing. So I downmixed the .ac3 to stereo .wav with BeLight and used that one. Now everything's shiny.
    Quote Quote  
  16. Originally Posted by hech54 View Post
    ....or just drag the file into VDub and stop fvkking around with AviSynth when it isn't necessary.
    I use AviSynth to cut, join and fade in/out.
    Quote Quote  
  17. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    VDub and AviDemux do all I need....and they open my files WITH AUDIO every time.
    Quote Quote  
  18. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by Sebastian2011 View Post
    Thanks a lot, that helped! Since the source is a DVD, I tried again to use .d2v and .ac3 out of DGIndex files via AviSynth, which resulted in the same problem. When I used GetChannel(3), I got audio, but the music was missing. So I downmixed the .ac3 to stereo .wav with BeLight and used that one. Now everything's shiny.

    Simpler to downmix in Avisynth:

    Best is to put the downmix functions on an avsi file in your Avisynth plugins folder, then you can call them like any built in function.
    Otherwise, just put the function in the same file:
    Code:
    AVISource("test.avi")
    Dmix6Dpl()
    
    #Downmix Dolby pro-logic 6 channels to stereo 
    function Dmix6Dpl(clip a)
    {
      flr = GetChannel(a, 1, 2)
      fcc = GetChannel(a, 3, 3)
      lrc = MixAudio(flr, fcc, 0.3205, 0.2265)
      bl  = GetChannel(a, 5)
      br  = GetChannel(a, 6)
      sl  = MixAudio(bl, br, 0.2265, 0.2265)
      sr  = MixAudio(bl, br, -0.2265, -0.2265)
      blr = MergeChannels(sl, sr)
      return MixAudio(lrc, blr, 1.0, 1.0)
    }
    Quote Quote  
  19. Originally Posted by AlanHK View Post
    Originally Posted by Sebastian2011 View Post
    Thanks a lot, that helped! Since the source is a DVD, I tried again to use .d2v and .ac3 out of DGIndex files via AviSynth, which resulted in the same problem. When I used GetChannel(3), I got audio, but the music was missing. So I downmixed the .ac3 to stereo .wav with BeLight and used that one. Now everything's shiny.

    Simpler to downmix in Avisynth:

    Best is to put the downmix functions on an avsi file in your Avisynth plugins folder, then you can call them like any built in function.
    Otherwise, just put the function in the same file:
    Code:
    AVISource("test.avi")
    Dmix6Dpl()
    
    #Downmix Dolby pro-logic 6 channels to stereo 
    function Dmix6Dpl(clip a)
    {
      flr = GetChannel(a, 1, 2)
      fcc = GetChannel(a, 3, 3)
      lrc = MixAudio(flr, fcc, 0.3205, 0.2265)
      bl  = GetChannel(a, 5)
      br  = GetChannel(a, 6)
      sl  = MixAudio(bl, br, 0.2265, 0.2265)
      sr  = MixAudio(bl, br, -0.2265, -0.2265)
      blr = MergeChannels(sl, sr)
      return MixAudio(lrc, blr, 1.0, 1.0)
    }
    Thanks a lot, it works fine and is indeed easier! Sorry for the late reply, I just didn't get around to it sooner. May I ask, is the function automatically applied to all clips if there are multiple ones? Is the "clip" in the function name a custom name or is it part of the syntax?
    Quote Quote  
  20. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by Sebastian2011 View Post
    May I ask, is the function automatically applied to all clips if there are multiple ones? Is the "clip" in the function name a custom name or is it part of the syntax?
    The function is not applied automatically, and has to be explicitly called in order to be applied to some clip.
    Here the line Dmix6Dpl() is calling the function - since no clip is explicitly mentioned, the call is implicitly applied to the result of the previous operation (the source clip from AVISource()).

    "clip" in the function definition is the type of the parameter 'a'.
    For more details on Avisynth script functions, see
    http://avisynth.org/mediawiki/User_defined_script_functions
    Quote Quote  
  21. Originally Posted by Gavino View Post
    Originally Posted by Sebastian2011 View Post
    May I ask, is the function automatically applied to all clips if there are multiple ones? Is the "clip" in the function name a custom name or is it part of the syntax?
    The function is not applied automatically, and has to be explicitly called in order to be applied to some clip.
    Here the line Dmix6Dpl() is calling the function - since no clip is explicitly mentioned, the call is implicitly applied to the result of the previous operation (the source clip from AVISource()).

    "clip" in the function definition is the type of the parameter 'a'.
    For more details on Avisynth script functions, see
    http://avisynth.org/mediawiki/User_defined_script_functions
    To the result of the previous operation, that answers it, thanks! I wasn't sure whether "clip" was a specific clip to apply the function to.
    Quote Quote  



Similar Threads

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