I use this script to demux MKVs in the current directory they are in then normalize the AAC audio then remux as MKV
for %%a in ("*.mkv") do (
"X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"%%~na.h264" 1:"%%~na.gain0"
for %%b in ("*.gain0") do "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%b" -vn -c:a copy -absf aac_adtstoasc "X:\Temp\gain.m4a"
"X:\Portable Installations\AAC Gain 1.9\aacgain.exe" -r -k -m 0 "X:\Temp\gain.m4a"
"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "X:\Temp\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac"
"X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AAC.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~na.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~da%%~pa%%~na.aac" ")" "--track-order" "0:0,1:0"
del "*.gain0"
del "*.h264"
del "*.aac"
del "X:\Temp\gain.m4a"
)
"X:\Sounds\VideoRedo Completed Sound Short.WAV"
pause
Does anybody have a script for doing the same for MP4 with Wav files?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
Last edited by VideoFanatic; 30th Jul 2021 at 16:40.
-
Hi.
This is my script for creating .aac from .wav files.
Code:for %%a in ("*.wav") do "C:\qaac_2.71\qaac64.exe" -c 0 -q 0 --limiter --rate keep --ignorelength --verbose "%%a" -o "%%~na.aac"
Code:for %%a in ("*.aac") do if exist "%%~na.mp4" ffmpeg.exe -i "%%~na.mp4" -i "%%a" -map 0:v -map 1:a -c:v copy -c:a copy -y "NEW-%%~na.mp4"
Cheers.Last edited by pcspeak; 30th Jul 2021 at 15:44.
-
I was hoping I would be able to normalise the Wav files without re-encoding to AAC and losing quality. Does such a thing exist which can be used in a script?
-
Ah, I slightly misunderstood.
This is somewhat old. I've no idea about the quality of the results.
The program modifies the original wav file. You have plenty of backups?
WaveGain v1.3.1
2011-12-16
https://www.rarewares.org/files/others/wavegains-1.3.1.zip
The command line:
Code:wavegain.exe -r -n -c -l -f WGLog.txt audio.wav
aac, at the highest quality. I cannot tell the difference between that and the wav file, using a very good set of Senheisser headphones.
Mind you, my hearing ability may be part of the result.
Cheers -
Thanks. Can I still use that as part of my video muxing script? Does it normalize to the same volume as AAC Gain?
Is it re-encoding the audio or is it just changing the volume like AAC gain? -
I don't know what you're trying to re-encode so I have no answers. Testing is the best way.
Drop the normalized wav and the normalized aac into Audacity and view the spectrograms.
This will give some visible evidence. I'm not sure how much it will help, but that's what I'd do.
I feel they will be very close to the same. Audio codecs are quite mature and results are amazing.
I stick by my first choice. Switch to highest quality aac audio.
A test mkv I have has these streams.
Code:C:\aa>ffmpeg -i 5.mkv Input #0, matroska,webm, from '5.mkv': Metadata: encoder : libebml v1.4.2 + libmatroska v1.6.4 creation_time : 2021-06-16T04:39:14.000000Z Duration: 00:00:19.72, start: 0.000000, bitrate: 1398 kb/s Chapters: Chapter #0:0: start 0.000000, end 19.720000 Stream #0:0: Video: h264 (Main), yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 718x430 [SAR 64:45 DAR 22976:9675]......... Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default) Stream #0:2(eng): Subtitle: dvd_subtitle, 720x576 (default) Stream #0:3(fre): Audio: aac (LC), 48000 Hz, stereo, fltp (default) Stream #0:4(fre): Subtitle: dvd_subtitle, 720x576 (default) Stream #0:5(spa): Audio: aac (LC), 48000 Hz, stereo, fltp (default) Stream #0:6(spa): Subtitle: dvd_subtitle, 720x576 (default) C:\aa>
1 Video
3 Audio
3 Subtitle
1 Chapters
With a bit of work, it could possibly be done with ffmpeg.exe.
Perhaps a forum member has a script using MKVMerge.exe to extract individual audio streams.
Is it re-encoding the audio or is it just changing the volume like AAC gain?
The original file is changed. No output file is created. My thought is it's re-encoding.
You'll need to do some searching and reading on the web.
Cheers. -
Thanks. I've used your MP4 muxing line in another script below. My file has AAC to start off with so I might as well use AACGain in my script and then convert to Wav however at the moment there's no point in me doing that or using wavegain in my script because FFMPEG won't create an MP4 with Wav:
https://forum.videohelp.com/threads/402656-Can-t-get-FFMPEG-Script-to-Remux-to-MP4-wit...KV#post2627142
Similar Threads
-
Movie thumbnailer Batch script help
By iKron in forum Newbie / General discussionsReplies: 2Last Post: 23rd Jul 2021, 00:57 -
Useful FFmpeg Windows Batch Script
By Guanadon in forum Newbie / General discussionsReplies: 0Last Post: 22nd Sep 2020, 11:48 -
Need Batch script help to prevent it asking for a language
By VideoFanatic in forum Video ConversionReplies: 0Last Post: 20th Dec 2019, 20:45 -
problem with youtube-dl used in batch script
By stax76 in forum ProgrammingReplies: 0Last Post: 27th Jun 2019, 21:52 -
Batch Script for Youtube-dl
By syalazar in forum Video Streaming DownloadingReplies: 1Last Post: 5th Feb 2019, 11:10