Skip to content
Snippets Groups Projects
Commit 24d6d2b5 authored by Conrad Zelck's avatar Conrad Zelck
Browse files

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: default avatarConrad Zelck <git@simpel.cc>
parent 54f419b8
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -11,13 +11,13 @@ If there are more then one stereo or two mono tracks you get a popup to choose t
![select tracks](./images/select_tracks.png)
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.
![GUI](./images/gui.png)
`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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment