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
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
Last edited by MrBiggles; 30th Aug 2015 at 07:35.
-
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
..
) -
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.
-
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
Similar Threads
-
batch: how to get duration & number of frames of a wav file with ffprobe?
By marcorocchini in forum Newbie / General discussionsReplies: 20Last Post: 31st Oct 2014, 18:47 -
Encoding AAC Audio from an Avisynth script
By pengy in forum AudioReplies: 3Last Post: 6th Sep 2012, 13:09 -
Batch Convert 6 channel AAC to AC3?
By massarosareloud in forum Video ConversionReplies: 11Last Post: 22nd Oct 2011, 14:41 -
Mp4, Aac & Wav Extraction
By mahendras in forum Newbie / General discussionsReplies: 2Last Post: 11th Oct 2010, 08:27 -
Ac3 Normalize + avisynth script
By sgbd in forum AudioReplies: 3Last Post: 27th Sep 2010, 09:05