Here's my script:
The bold line above is taking the following 2 files and muxing them into an MKV file: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"
for %%b in ("*.aac") do "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%b" -vn -c:a pcm_s16le -ac 2 -ar 48000 -f wav "%%~nb.wav"
for %%a in ("*.wav") 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"
del "*.gain0"
del "*.h264"
del "*.aac"
del "*.wav"
del "X:\Temp\gain.m4a"
)
"X:\Sounds\VideoRedo Completed Sound Short.WAV"
pause
filename.wav
filename.h264
The script ends up making an MKV with AAC instead of an MP4 with Wav. If I move the "del" aac line after the underlined line above then NO MP4 is made.
It seems ffmpeg doesn't like creating MP4 files with Wav because Wav isn't part of the MP4 spec? Yet Adobe Premier and social media sites accept MP4 with Wav.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 4 of 4
Thread
-
-
At the end of your script; this should work.
Code:del *.gain0 *.h264 *.aac *.wav X:\Temp\gain.m4a
for %%a in ("*.wav") 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"
"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "X:\Temp\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac"
Code:ren *.m4a *.aac
Last edited by pcspeak; 1st Aug 2021 at 20:08.
-
@VideoFanatic.
To boost audio this is what I've used for several years.
https://github.com/lordmulder/DynamicAudioNormalizer
It can be stand alone, but the library is compiled into most recent editions of ffmpeg.
I've always thought it good value.
Some more info.
https://www.videohelp.com/software/Dynamic-Audio-Normalizer.
I've cobbled this together.
The batch file runs ffmpeg against all MKV & MP4 videos in a folder and subfolders.
The Destination root path needs to be set. It's lines 5 & 6 in the batch file.
It can be the same drive, different path. For safety' sake.
WARNING: There may be bugs.
Cheers.
Audio Boost with dynaudnorm v01.cmd
Code:@echo off if exist videolist.txt del /q videolist.txt :: Set a root folder for the output. if not exist D:\newvids md D:\newvids set outdrv=D:\newvids :: create an input list of videos for /F "usebackq delims=" %%a in (`dir *.mkv *.mp4 /B /S`) do echo %%~dpnxa>> VideoList.txt :: Process the list for /f "delims=" %%a in (videolist.txt) do call :process "%%~da" "%%~pa" "%%~nxa" goto :end :process :: Set the variables set indrv=%~1 set videopath=%~2 set video=%~3 Title "%~3" :: Create the destination folder if not exist "%outdrv%%videopath%" md "%outdrv%%videopath%" ffmpeg.exe -hide_banner -i "%indrv%%videopath%%video%" -c:v copy -c:a aac -af dynaudnorm -ar 48000 -threads 0 -y "%outdrv%%videopath%%video%" goto :eof :end
Similar Threads
-
Batch remux mkv to mp4 with Windows PowerShell
By [ss]vegeta in forum Newbie / General discussionsReplies: 0Last Post: 22nd Dec 2020, 14:48 -
Program that will remux MKV, FLV, and AVI to MP4
By 90sTV in forum MacReplies: 5Last Post: 18th Apr 2019, 17:33 -
FFMPEG Conversion from MKV to MP4 returns a empty MP4 file?
By lolmaisine in forum Video ConversionReplies: 4Last Post: 6th Mar 2019, 07:45 -
FFMPEG Batch Script wanted for H265 Remux
By VideoFanatic in forum Video ConversionReplies: 5Last Post: 21st Jan 2018, 10:38 -
Need help with ffmpeg script to batch convert audio in MKV files
By mikeveli20 in forum AudioReplies: 5Last Post: 18th Nov 2016, 13:21