From 0d958f97625cd7a7dc15c97742845b66342a74be Mon Sep 17 00:00:00 2001
From: Simpel <git@simpel.cc>
Date: Mon, 8 May 2023 14:43:13 +0200
Subject: [PATCH] fix: enclose extracted output file w/ quotes

Signed-off-by: Conrad Zelck <git@simpel.cc>
---
 R128.au3 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/R128.au3 b/R128.au3
index 817a3dc..5dc11a7 100644
--- a/R128.au3
+++ b/R128.au3
@@ -2,7 +2,7 @@
 #AutoIt3Wrapper_Icon=Icons\peakmeter.ico
 #AutoIt3Wrapper_Res_Comment=Measure loudness with ffmpeg according to R128.
 #AutoIt3Wrapper_Res_Description=Measure loudness with ffmpeg according to R128.
-#AutoIt3Wrapper_Res_Fileversion=1.1.0.19
+#AutoIt3Wrapper_Res_Fileversion=1.1.0.20
 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
 #AutoIt3Wrapper_Res_CompanyName=Norddeutscher Rundfunk
 #AutoIt3Wrapper_Res_LegalCopyright=Conrad Zelck
@@ -181,15 +181,17 @@ GUISetState(@SW_SHOW)
 Global $hTimerStart = TimerInit()
 $sOutputFileWithoutExtension &= "_" & $iTrackL & "+" & $iTrackR
 
+ConsoleWrite("Layout: " & $iLayout & @CRLF)
 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 & '\' & $sOutputFileWithoutExtension & '.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 & '\' & $sOutputFileWithoutExtension & '.wav'
+		$sCommand = '-i "' & $sFile & '" -map 0:' & $iTrackR / 2 - 1 + $iCounterVideo & ' -c:a pcm_s24le -ar 48000 -y "' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav"'
 	Case $eMULTI
-		$sCommand = '-i ' & $sFile & ' -af "pan=stereo|c0=c' & $iTrackL - 1 + $iCounterVideo & '|c1=c' & $iTrackR - 1 + $iCounterVideo & '" -c:a pcm_s24le -ar 48000 -y ' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav'
+		$sCommand = '-i ' & $sFile & ' -af "pan=stereo|c0=c' & $iTrackL - 1 + $iCounterVideo & '|c1=c' & $iTrackR - 1 + $iCounterVideo & '" -c:a pcm_s24le -ar 48000 -y "' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav"'
 EndSwitch
 
+ConsoleWrite("Command extract audio: " & $sCommand & @CRLF)
 _runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 1)
 GUICtrlSetData($Progress1, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed
 
@@ -197,6 +199,7 @@ If Not FileExists(@TempDir & '\' & $sOutputFileWithoutExtension & '.wav') Then ;
 	GUICtrlSetData($Edit, "Error: Could not extract audio.")
 Else
 	$sCommand = '-i "' & @TempDir & '\' & $sOutputFileWithoutExtension & '.wav" -filter_complex ebur128=framelog=verbose:peak=true -f null -'
+	ConsoleWrite("Command measure audio: " & $sCommand & @CRLF)
 	_runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 2)
 	GUICtrlSetData($Progress2, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed
 
-- 
GitLab