Skip to content
Snippets Groups Projects
Select Git revision
  • 7a0026e28d9492471be41643e9b42a1b017cf953
  • main default protected
  • 3.1.7
  • 3.1.6
  • 3.1.5
  • 3.1.4
  • 3.1.3
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 2.14.0
  • 2.13.5
  • 2.13.4
  • 2.13.3
  • 2.13.2
  • 2.13.0
  • 2.12.1
  • 2.12.0
  • 2.11.0
  • 2.10.1
  • 2.10.0
  • 2.9.1
22 results

log-to-file.js

Blame
  • R128.au3 13.67 KiB
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #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.21
    #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
    #AutoIt3Wrapper_Res_CompanyName=Norddeutscher Rundfunk
    #AutoIt3Wrapper_Res_LegalCopyright=Conrad Zelck
    #AutoIt3Wrapper_Res_SaveSource=y
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Res_Field=Copyright|Conrad Zelck
    #AutoIt3Wrapper_Res_Field=Compile Date|%date% %time%
    #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
    #AutoIt3Wrapper_Run_Au3Stripper=y
    #Au3Stripper_Parameters=/mo
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <AutoItConstants.au3>
    #include <ButtonConstants.au3>
    #include <Date.au3>
    #include <FileConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <MsgBoxConstants.au3>
    #include <StaticConstants.au3>
    #include <StringConstants.au3>
    #include <TrayCox.au3> ; source: https://github.com/SimpelMe/TrayCox - not needed for functionality
    
    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)
    Local $sPathFFprobe = @TempDir & "\"
    Global $g_sStdErrAll
    
    $cmdlineraw = StringReplace($cmdlineraw, '"', '') ; if there are spaces in filename $cmdlineraw is adding leading and trailing "
    Local $sFile
    If FileExists($cmdlineraw) Then
    	$sFile = $cmdlineraw
    Else
    	$sFile = FileOpenDialog("Choose a file", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "Alle (*.*)", $FD_FILEMUSTEXIST)
    	If @error Then
    		MsgBox($MB_TOPMOST, "Error", "File selection failed." & @CRLF & @CRLF & "Application exits.")
    		Exit
    	EndIf
    EndIf
    Local $sOutputFileWithoutExtension = _StripFileExtension(_FileName($sFile))
    
    SplashTextOn("Be patient", "R128 is analysing file ...", 300, 50)
    
    ; how many video streams to increase stream counter
    Local $sCommand = '-i "' & $sFile & '" -v 0 -show_entries stream=codec_type -of default=nw=1:nk=1'
    Local $sCodecs = _runFFprobe('ffprobe ' & $sCommand, $sPathFFprobe)
    ConsoleWrite("Codecs: " & $sCodecs & @CRLF)
    StringReplace($sCodecs, "video", "video") ; just to get the count
    Local $iCounterVideo = Number(@extended)
    ConsoleWrite("Counter video: " & $iCounterVideo & @CRLF)
    
    ; is audio inside?
    StringReplace($sCodecs, "audio", "audio") ; just to get the count
    If @extended = 0 Then
    	SplashOff()
    	MsgBox($MB_TOPMOST, "Error", "No audio channels found.")
    	Exit
    EndIf
    
    ; channel layout for all audio streams
    $sCommand = '-i "' & $sFile & '" -v 0 -select_streams a -show_entries stream=channels -of default=nw=1:nk=1'
    Local $sChannels = _runFFprobe('ffprobe ' & $sCommand, $sPathFFprobe)
    SplashOff()
    Local $aChannels = StringSplit($sChannels, @CRLF, $STR_ENTIRESPLIT)
    If Not IsArray($aChannels) Then
    	MsgBox($MB_TOPMOST, "Error", "No audio channels found.")