VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date
    Sep 2009
    Location
    Iran, Islamic Republic of
    Search Comp PM
    How could I change the default audio stream in a Dual or Multi Audio AVI file?

    I own some .avi movie Files with the properties Like below

    Video: Xvid 720x296 25.00fps [Stream 00]
    Audio: Dolby AC3 48000Hz 6ch 448Kbps [Stream 01]
    Audio: Dolby AC3 48000Hz 5ch 448Kbps [Stream 02]

    The thing I Actually want to do is to have the second stream as [Stream 01] so it would be played by default in Media Player or MPC when opening ?

    is there any software which could do so ?
    Quote Quote  
  2. Try AVI-Mux gui , with the tracks loaded and audio track you want highlighted, you can right click the audio stream and select "default track"
    Quote Quote  
  3. Member
    Join Date
    Sep 2009
    Location
    Iran, Islamic Republic of
    Search Comp PM
    Thank you for the Suggestion, I take your advise do the job right as you said,
    for the first time both audio streams were selected as default I uncheck the first one as default, but after getting the output it was the same as input file again I do the whole job and this time I uncheck the first audio in addition of unchecking first stream default audio again it does not make any change to input file, please help if I should do anything I have n't done so far.
    Quote Quote  
  4. Hi,

    I was having the same problem and the above solution did not work for me. Furthermore, my situation was that I have hundreds of files sorted according to "seasons" which I wanted to process without much hassle. Unfortunately, programs such as handbrake do not allow for video passthrough while others, such as Avidemux only has limited support for a second audio track (which, in the case of Avidemux must come from an external file, not from within the video). "Standard" VirtualDub has no option to modify a second audio track, but finally I stumbled upon VirtualDubMod which is capable of doing the task I wanted. While not scriptable from command line, at least it offers plain text job files. To create customized job files, I wrote the script below in Perl. You can even use tinyperl to run it from within Windows without installing a large scale perl distribution.

    What the script does is that it browses through one (and just one!) level of subdirectories and adds all *.avi files to a job file called "audioswap.jobs". Simply load this file into VirtualDubMod's job processor and start the task. All files will be written to a respective subdirectory called "converted" with the same file name. Original files will be kept in place, so make sure you have enough disk space. Once you are satisfied with the results, you can move all files from the "converted" directory one level up, thereby replacing the old versions.

    Note that this program will always swap the first audio track with the second, so if you run the audioswap.jobs file again, you'll get back to the previous state. Also note that conversion will stall and not continue if there is only one audio track available. I also haven't checked the behaviour on three or more audio tracks (if that should be possible with AVIs).

    How to run the script:

    You need to have a directory structure like that:

    .\Name-of-Series\Name-of-Season[1..X]
    ...
    Put the vd-conv.pl in the directory "Name-of-Series" and run it with a perl interpreter, e.g.:
    \path\to\perl\tinyperl.exe .\vd-conv.pl

    vd-conv.pl will output the names of the subdirectories it has processed and write the audioswap.jobs file in the current directory. As this file contains the full path names, you can put the jobs file wherever you like as long as you do not change the directory structure in which case you need to run the script again.
    Be reminded that the script expects the avi files in a subdirectory of the current directory, so if you have all files in the same directory, create a temporary subdirectory and move the avis there (such as ".\Name-of-Series\Temp"). Once the conversion is done, you can move the files to their original place.

    Another caveat are non-ASCII characters in file names or some characters not allowed in file names. I have included a limited conversion for German "Umlaute", but French, Spanish (and especially non-Latin-based languages) will have to do (a lot) of added conversion if the file names include or consist only of these characters. Batch processing will still continue, but VirtualDubMod will not process these specific files, marking them with an "Error" result code.

    Ok, enough talk, here's the code:

    Code:
    use Cwd;
    
    open (JOBS, ">audioswap.jobs");
    
    opendir (PARENT, ".");
    @parentdir = readdir PARENT;
    
    foreach $parent (@parentdir) {
      if ((-x $parent) && ($parent ne "..") && ($parent ne ".")) {
        print "$parent\n";
        chdir ($parent);
    
        $dir = ".";
        mkdir ("./converted");
    
        $path = getcwd;
        $path =~ s/\//\\\\/g;
    
        opendir DIR, $dir;
        @dir = grep /.*\.avi/, readdir DIR;
    
        print JOBS <<ENDTEXT;
    // VirtualDub job list (Sylia script format)
    // This is a program generated file -- edit at your own risk.
    //
    //
    ENDTEXT
    
        foreach $entry (@dir) {
          $job++;
          $entry =~ s//\\xc3\\x84/g;
          $entry =~ s//\\xc3\\xa4/g;
          $entry =~ s//\\xc3\\x96/g;
          $entry =~ s//\\xc3\\xb6/g;
          $entry =~ s//\\xc3\\x9c/g;
          $entry =~ s//\\xc3\\xbc/g;
          $entry =~ s//\\xc3\\x9f/g;
          $entry =~ s//\\xc3\\xa9/g;      
          $entry =~ s//\\xe2\\x80\\x99/g;
    
          print JOBS <<ENDTEXT;
    
    // \$job "Job $entry"
    // \$state 0
    // \$start_time 0 0
    // \$end_time 0 0
    // \$script
    
    VirtualDub.Open("$path\\\\$entry","",0);
    VirtualDub.RemoveInputStreams();
    VirtualDub.stream[0].SetSource(0x73647561,1,1);
    VirtualDub.stream[0].DeleteComments(1);
    VirtualDub.stream[0].AdjustChapters(1);
    VirtualDub.stream[0].SetMode(0);
    VirtualDub.stream[0].SetInterleave(1,500,1,0,0);
    VirtualDub.stream[0].SetClipMode(1,1);
    VirtualDub.stream[0].SetConversion(0,0,0,0,0);
    VirtualDub.stream[0].SetVolume();
    VirtualDub.stream[0].SetCompression();
    VirtualDub.stream[0].EnableFilterGraph(0);
    VirtualDub.stream[0].filters.Clear();
    VirtualDub.stream[1].SetSource(0x73647561,0,1);
    VirtualDub.stream[1].DeleteComments(1);
    VirtualDub.stream[1].AdjustChapters(1);
    VirtualDub.stream[1].SetMode(0);
    VirtualDub.stream[1].SetInterleave(1,500,1,0,0);
    VirtualDub.stream[1].SetClipMode(1,1);
    VirtualDub.stream[1].SetConversion(0,0,0,0,0);
    VirtualDub.stream[1].SetVolume();
    VirtualDub.stream[1].SetCompression();
    VirtualDub.stream[1].EnableFilterGraph(0);
    VirtualDub.stream[1].filters.Clear();
    VirtualDub.video.DeleteComments(1);
    VirtualDub.video.AdjustChapters(1);
    VirtualDub.video.SetDepth(24,24);
    VirtualDub.video.SetMode(0);
    VirtualDub.video.SetFrameRate(0,1);
    VirtualDub.video.SetIVTC(0,0,-1,0);
    VirtualDub.video.SetRange(0,0);
    VirtualDub.video.SetCompression();
    VirtualDub.video.filters.Clear();
    VirtualDub.SaveAVI("$path\\\\converted\\\\$entry");
    VirtualDub.Close();
    // \$endjob
    //
    //--------------------------------------------------
    
    ENDTEXT
        }
        chdir ("..");
      }
    }
    Hope this helps,

    F.
    Quote Quote  



Similar Threads