From 24d6d2b55957094c80150eb48d6e7771d7e9f65b Mon Sep 17 00:00:00 2001 From: Conrad Zelck <git@simpel.cc> Date: Fri, 22 Jan 2021 17:42:58 +0100 Subject: [PATCH] feat: extract wave file with given filename Extracted wave files should often used later on. So I will use not standard name 'output.wav' but the name of the original file given. - remove file delete 'output.wav' - change output file name to original file as wav Signed-off-by: Conrad Zelck <git@simpel.cc> --- R128.au3 | 15 ++++++++++----- README.md | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/R128.au3 b/R128.au3 index f971f57..e37b124 100644 --- a/R128.au3 +++ b/R128.au3 @@ -24,7 +24,6 @@ #include <StringConstants.au3> #include <TrayCox.au3> ; source: https://github.com/SimpelMe/TrayCox - not needed for functionality -FileDelete(@TempDir & '\output.wav') FileInstall('K:\ffmpeg\bin\ffmpeg.exe', @TempDir & "\ffmpeg.exe", $FC_OVERWRITE) Local $sPathFFmpeg = @TempDir & "\" FileInstall('K:\ffmpeg\bin\ffprobe.exe', @TempDir & "\ffprobe.exe", $FC_OVERWRITE) @@ -42,6 +41,7 @@ Else Exit EndIf EndIf +Local $sOutputFileWithoutExtension = _StripFileExtension(_FileName($sFile)) SplashTextOn("Be patient", "R128 is analysing file ...", 300, 50) @@ -181,18 +181,18 @@ Global $hTimerStart = TimerInit() Switch $iLayout Case $eMONO - $sCommand = '-i "' & $sFile & '" -filter_complex "[0:' & $iTrackL - 1 + $iCounterVideo & '][0:' & $iTrackR - 1 + $iCounterVideo & '] amerge" -c:a pcm_s24le -ar 48000 -y ' & @TempDir & '\output.wav' + $sCommand = '-i "' & $sFile & '" -filter_complex "[0:' & $iTrackL - 1 + $iCounterVideo & '][0:' & $iTrackR - 1 + $iCounterVideo & '] amerge" -c:a pcm_s24le -ar 48000 -y ' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav' Case $eSTEREO - $sCommand = '-i "' & $sFile & '" -map 0:' & $iTrackR / 2 - 1 + $iCounterVideo & ' -c:a pcm_s24le -ar 48000 -y ' & @TempDir & '\output.wav' + $sCommand = '-i "' & $sFile & '" -map 0:' & $iTrackR / 2 - 1 + $iCounterVideo & ' -c:a pcm_s24le -ar 48000 -y ' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav' EndSwitch _runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 1) GUICtrlSetData($Progress1, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed -If Not FileExists(@TempDir & '\output.wav') Then ; error +If Not FileExists(@TempDir & '\' & $sOutputFileWithoutExtension & '.wav') Then ; error GUICtrlSetData($Edit, "Error: Could not extract audio.") Else - $sCommand = '-i "' & @TempDir & '\output.wav" -filter_complex ebur128=framelog=verbose:peak=true -f null -' + $sCommand = '-i "' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav" -filter_complex ebur128=framelog=verbose:peak=true -f null -' _runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 2) GUICtrlSetData($Progress2, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed @@ -286,6 +286,11 @@ Func _FileName($sFullPath) Return StringTrimLeft($sFullPath, $iDelimiter) EndFunc +Func _StripFileExtension($sFile) + Local $iDelimiter = StringInStr($sFile, ".", 0, -1) + Return StringLeft($sFile, $iDelimiter - 1) +EndFunc + Func _Zeit($iMs, $bComfortView = True) ; from ms to a format: "12h 36m 56s 13f" (with special space between - ChrW(8239)) Local $sReturn $iMs = Int($iMs) diff --git a/README.md b/README.md index 6f92060..5041b35 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ If there are more then one stereo or two mono tracks you get a popup to choose t  -The choosen tracks are first extracted to `%temp%` as `output.wav` in 24bit and 48kHz. +The choosen tracks are first extracted to `%temp%` in 24bit and 48kHz. Progress is shown in the gui. Then it measures this wave file. If ready you can copy the result to the clipboard.  -`Output.wav` will stay at `%temp%` until overridden. +Extracted wave file will stay at `%temp%`. So you can use the app as an audio extractor or audio converter too. As windows FFmpeg build is licensed under GPL and therefor incompatible with MIT license I can't offer a compiled release. -- GitLab