VideoHelp Forum
+ Reply to Thread
Results 1 to 15 of 15
Thread
  1. I have a blu-ray source I am trying to encode, but its been split up into multiple parts. I have combined the video easily and that comes out just fine, I am having trouble with the audio.

    Normally I just append these together with mkvmerge/mkvtoolnix, but it will not append correctly and goes out of sync as the video goes on. Most likely the audio tracks are not as long as the individual video's or are slightly shorter than the video length.

    I figured encoding with ++ and avisynth would be my best bet since supposedly it will fill in the empty gaps if there are any. I am having a problem with it though. I dont know for sure how to do this. Can anyone help with how I would write the script for this?

    Here is what I have so far for the video.

    Code:
    Insert2=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00055\00055.avs")
    Insert3=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00053\00053.avs")
    Insert4=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00056\00056.avs")
    Insert5=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00054\00054.avs")
    Insert6=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00057\00057.avs")
    Insert7=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00058\00058.avs")
    Insert8=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00059\00059.avs")
    Insert9=Import("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00060\00060.avs")
    
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgavcindex\DGAVCDecode.dll")
    AVCSource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00052\00052.dga")
    
    __film = last
    __t0 = __film.trim(0, 0)
    __t0 ++ Insert2 ++ Insert3 ++ Insert4 ++ Insert5 ++ Insert6 ++ Insert7 ++ Insert8 ++ Insert9

    What would I add and how would I add it if I wanted to encode the audio via avisynth script as well?

    I used to use this when doing only one file, but this is multiple and connecting multiple, so it wont work for me in this situation.

    Code:
    a = ffaudiosource("C:\Users\???\Desktop\Encoding\Video\DVD\Episode 1\VTS_01_1 T80 3_2ch 448Kbps DELAY 0ms.ac3")
    v = DGDecode_mpeg2source("C:\Users\???\Desktop\Encoding\Video\DVD\Episode 1\VTS_01_1.d2v", info=3)
    AudioDub(v,a)

    All of the audio files are in each different folder with the video files I loaded in the script, and their names are all exactly the same. T2_Audio - English.flac I just thought I would mention that in case the names of the audio files were needed.
    Last edited by killerteengohan; 14th Mar 2021 at 18:08.
    Quote Quote  
  2. Include the audio in your insert videos.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Include the audio in your insert videos.
    How would I do that exactly?

    Here is the script for insert 2

    Code:
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgavcindex\DGAVCDecode.dll")
    AVCSource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00055\00055.dga")
    What would I do to include the audio? and once that's done, how do I tell it to combine/connect with the others?
    Quote Quote  
  4. The same way you include the audio in your other example.

    Code:
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgavcindex\DGAVCDecode.dll")
    a = ffaudiosource("C:\path_to_audio\filename.ext")
    v = AVCSource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00055\00055.dga")
    AudioDub(v,a)
    Do that in each of your "insert" AVS files, and with the AVCSource in your main AVS file.
    Quote Quote  
  5. Wow that actually worked. I didn't even have to tell it how to connect to the others. I thought I was going to have to go into each individual script, import the next piece, and attach it to the current piece. Then do this one by one, until each one was connected to the next one, and then a final script would join them all together.
    Quote Quote  
  6. Is there any special way to connect a 2 channel audio to a 6 channel audio without downmuxing the 6 channel into 2 channel?
    Quote Quote  
  7. Here's a simple AviSynth funtion to convert 2 channels to 6 channels by adding four silent channels to the existing stereo pair:

    Code:
    function a2to6(clip v)
    {
        silent = v.Amplify(0.0)
        MergeChannels(v, silent, silent) # 5.1 order FL FR FC LFE RL RR
    }
    This does the same thing but is more descriptive:

    Code:
    function a2to6(clip v)
    {
        left = v.GetChannel(1)
        right = v.GetChannel(2)
        silent = left.ConvertToMono().Amplify(0.0)
        six = MergeChannels(left, right, silent, silent, silent, silent) # 5.1 order FL FR FC LFE RL RR
        AudioDub(v,six)
    }
    All channels except FR and FR are silent.
    Quote Quote  
  8. Thanks, I never knew about those options in avisynth. I will play around them some.

    Would duplicating the the 2 channels until you have 4 channels, and adding 2 silent ones work as well? That way the L would be FL/RL, and R would be FR/RR and the other 2 would be silent? I'm still trying to figure that one out with setting tinkering in your more descriptive example.
    Quote Quote  
  9. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    You will then have extrawide, phantom L & R channels. Not optimal if you want distinct sound sources.


    Scott
    Quote Quote  
  10. Originally Posted by killerteengohan View Post
    Would duplicating the the 2 channels until you have 4 channels, and adding 2 silent ones work as well? That way the L would be FL/RL, and R would be FR/RR and the other 2 would be silent?
    It may not sound "better" but If you want to try it :

    If you want to try it you could use

    Code:
    function a2to6(clip v)
    {
        silent = v.Amplify(0.0)
        MergeChannels(v, silent, v) # 5.1 order FL FR FC LFE RL RR
    }
    or:

    Code:
    function a2to6(clip v)
    {
        left = v.GetChannel(1)
        right = v.GetChannel(2)
        silent = left.ConvertToMono().Amplify(0.0)
        six = MergeChannels(left, right, silent, silent, left, right) # 5.1 order FL FR FC LFE RL RR
        AudioDub(v,six)
    }
    Quote Quote  
  11. Am I using this wrong? It makes my script break, and say invalid argument to function trim. (For this line) __t0 = __film.trim(25, 2080)

    Code:
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgavcindex\DGAVCDecode.dll")
    a = ffaudiosource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00052\T2_Audio - English.flac")
    v = AVCSource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00052\00052.dga")
    
    
    function a2to6(clip v)
    {
        left = v.GetChannel(1)
        right = v.GetChannel(2)
        silent = left.ConvertToMono().Amplify(0.0)
        six = MergeChannels(left, right, silent, silent, silent, silent) # 5.1 order FL FR FC LFE RL RR
        AudioDub(v,six)
    }
    
    __film = last
    __t0 = __film.trim(25, 2080)
    __t0

    It works fine when I take out the function a2to6 part of the script and put in AudioDub(v,a) in its place.
    Quote Quote  
  12. Code:
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgavcindex\DGAVCDecode.dll")
    
    function a2to6(clip v)
    {
        left = v.GetChannel(1)
        right = v.GetChannel(2)
        silent = left.ConvertToMono().Amplify(0.0)
        six = MergeChannels(left, right, silent, silent, silent, silent) # 5.1 order FL FR FC LFE RL RR
        AudioDub(v,six)
    }
    
    a = ffaudiosource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00052\T2_Audio - English.flac")
    v = AVCSource("C:\Users\???\Desktop\Encoding\Video\USA\OVA\00052\00052.dga")
    AudioDub(v,a)
    a2to6()
    
    __film = last
    __t0 = __film.trim(25, 2080)
    __t0
    Quote Quote  
  13. Do I put that only in the pieces script where the audio for the piece is 2 channels, or do I put that in the final script and it will leave the 6 channel audio's alone?
    Quote Quote  
  14. It's just like every other function in AviSynth: it only effects streams to which you apply it.

    Code:
    av1 = WhateverSource().a2to6()
    av2 = WhateverSource()
    av1++av2
    Only av1 will have 2 channel audio converted to 6 channel. av2 will not be changed. If av2 doesn't already have 6 channels the last line will fail because both streams must have the same number of audio channels.
    Quote Quote  
  15. My encoder was using 100% cpu so I only just now got to try this. It seems to have worked perfectly.

    Thanks!
    Last edited by killerteengohan; 20th Mar 2021 at 01:14.
    Quote Quote  



Similar Threads

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