Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
R128
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Conrad Zelck
R128
Commits
1b0ffcae
Unverified
Commit
1b0ffcae
authored
5 years ago
by
Conrad Zelck
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add: error handling if extracting audio fails
parent
3f9071b3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R128.au3
+13
-8
13 additions, 8 deletions
R128.au3
with
13 additions
and
8 deletions
R128.au3
+
13
−
8
View file @
1b0ffcae
...
...
@@ -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.0.0.
5
#AutoIt3Wrapper_Res_Fileversion=1.0.0.
8
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_CompanyName=Norddeutscher Rundfunk
#AutoIt3Wrapper_Res_LegalCopyright=Conrad Zelck
...
...
@@ -22,6 +22,7 @@
#include <StaticConstants.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 & "\"
Global $g_sStdErrAll
...
...
@@ -104,12 +105,16 @@ Local $sCommand = '-i "' & $sFile & '" -filter_complex "[0:' & $iTrackL & '][0:'
_runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 1)
GUICtrlSetData($Progress1, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed
$sCommand = '-i "' & @TempDir & '\output.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
If Not FileExists(@TempDir & '\output.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 -'
_runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg, 2)
GUICtrlSetData($Progress2, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed
GUICtrlSetData($Edit, _GetR128($g_sStdErrAll))
GUICtrlSetState($idButton, $GUI_ENABLE)
GUICtrlSetData($Edit, _GetR128($g_sStdErrAll))
GUICtrlSetState($idButton, $GUI_ENABLE)
EndIf
WinActivate("R128","")
While 1
...
...
@@ -171,9 +176,9 @@ Func _GetTime($sStdErr)
EndFunc ;==>_GetTime
Func _GetR128($sStdErr)
If Not StringInStr($sStdErr, "Integrated loudness:") Then Return SetError(1, 0,
0
)
If Not StringInStr($sStdErr, "Integrated loudness:") Then Return SetError(1, 0,
"Fehler"
)
Local $aRegExp = StringRegExp($sStdErr, "(?isU)Integrated loudness:.*(I:.*LUFS).*(LRA:.*LU).*\h\h(Peak:.*dBFS)", 3)
If @error Or Not IsArray($aRegExp) Then Return SetError(2, 0,
0
)
If @error Or Not IsArray($aRegExp) Then Return SetError(2, 0,
"Fehler"
)
Local $iUbound = UBound($aRegExp)
Return $aRegExp[$iUbound -3] & @CRLF & $aRegExp[$iUbound - 2] & @CRLF & $aRegExp[$iUbound - 1]
EndFunc ;==>_GetR128
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment