Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v1) • Re: capture the output of an ffmpeg console command

$
0
0
You have to get information from StdErr instead of StdOut.

CODE:

DetectHiddenWindows On

command:= "ffmpeg -i FilePath.mp3 -hide_banner -nostats -filter:a volumedetect -vn -dn -sn -f null nul"
Run %ComSpec%,, Hide, pid
WinWait ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("Wscript.Shell")
exec := WshShell.Exec(command)
output := exec.StdErr.ReadAll()
MsgBox %output%
DllCall("FreeConsole")
Process Close, %pid%
return


RunE.ahk:

CODE:

RunE( mit )
{
return % ComObjCreate("WScript.Shell").Exec( mit ).StdErr.ReadAll()
}
msgbox % RunE( "ffmpeg -i ""b.webm"" -hide_banner -nostats -filter:a volumedetect -vn -dn -sn -f null nul" )

Result:

CODE:

Input #0, matroska,webm, from 'b.webm':
Metadata:
ENCODER : Lavf58.20.100
Duration: 00:03:31.62, start: -0.007000, bitrate: 2720 kb/s
Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default)
Metadata:
DURATION : 00:03:31.600000000
Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Metadata:
DURATION : 00:03:31.621000000
[Parsed_volumedetect_0 @ 00000177bdcb60c0] n_samples: 0
Stream mapping:
Stream #0:1 -> #0:0 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'nul':
Metadata:
encoder : Lavf60.20.100
Stream #0:0(eng): Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s (default)
Metadata:
DURATION : 00:03:31.621000000
encoder : Lavc60.36.100 pcm_s16le
[Parsed_volumedetect_0 @ 00000177bdcf5a40] n_samples: 10156966
[Parsed_volumedetect_0 @ 00000177bdcf5a40] mean_volume: -29.6 dB
[Parsed_volumedetect_0 @ 00000177bdcf5a40] max_volume: -11.9 dB
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_11db: 1
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_12db: 46
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_13db: 380
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_14db: 1580
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_15db: 4808
[Parsed_volumedetect_0 @ 00000177bdcf5a40] histogram_16db: 11190
[out#0/null @ 00000177be08f280] video:0kB audio:19838kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=N/A time=00:03:31.61 bitrate=N/A speed= 193x

Statistics: Posted by Dixtroy — Today, 09:57



Viewing all articles
Browse latest Browse all 579

Trending Articles