VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. I would like the output file names of the AAC, AC3 and Wav to match the original MKV file name. What do I need to do in the last line in my script to do that? The script works but I don't know how to get the output file names to match the original input file name. I can do it for the Wav but not the AAC and AC3.

    The script demuxes an MKV with AAC. Then it Normalizes the AAC and converts it to AC3. It also takes take original non-normalized AAC and converts it to Wav.

    Code:
    for %%a in ("*.mkv") do "D:\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"%%~na.h264" 1:"original.m4a" 
    
    for %%b in ("original.m4a") do "D:\ffmpeg\bin\ffmpeg.exe" -i "%%b" -vn -c:a pcm_s16le -ac 2 -ar 48000 -f wav "%%~nb.wav"
    
    for %%b in ("original.m4a") do "D:\ffmpeg\bin\ffmpeg.exe" -i "%%b" -vn -c:a copy -absf aac_adtstoasc "gain.m4a"
    
    for %%b in ("gain.m4a") do "D:\AAC Gain 1.9\aacgain" -r -k -m 0 gain.m4a
    
    for %%b in ("gain.m4a") do "D:\ffmpeg\bin\ffmpeg.exe" -i "gain.m4a" -map 0:0 -vn -c:a copy "%%~nb.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "%%~nb.ac3"
    
    del *.m4a
    
    pause
    Last edited by MrBiggles; 30th Aug 2015 at 07:35.
    Quote Quote  
  2. 1. Post error messages instead of just saying it's not "working".
    2. your for loop ends after the first line. You need something like this:
    for %%a in ("*.mkv") do (
    line 1
    line 2
    line 3
    ..
    )
    Quote Quote  
  3. I've changed my post. Please have a look.
    Quote Quote  
  4. No, it will not work that way. It will first loop over all files with the first line, overwriting "original.m4a" every time. Only after that the second line will start etc.
    Quote Quote  
  5. Do you have a script that will do what I want please?
    Quote Quote  
  6. create subroutine that would make it for you, it is also more readable then, .., that subroutine I started, :normalize_audio is not finished, because I am not sure at the moment if you have it right, it seems weird, nonetheless do structure like this (just remember %%a changes into %~1 in subroutine):
    Code:
    for %%a in ("*.mkv") do call :normalize_audio "%%a" 
    pause
    
    :normalize_audio
    "D:\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%~1" 0:"%~n1.h264" 1:"original.m4a" 
    "D:\ffmpeg\bin\ffmpeg.exe" -i "original.m4a" -vn -c:a pcm_s16le -ac 2 -ar 48000 -f wav "original.wav"
    .
    .
    .
    goto :eof
    Quote Quote  



Similar Threads

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