Really, really strange ...
The output seems to be piped to StderrRead() ????
Works if invoked in same dir as ffmpeg.exe, otherwise adjust the exe location accordingly...
#include<GUIConstants.au3>
#include<Constants.au3>
;Set OnEvent Mode
opt("GUIOnEventMode", 1)
;Set Must Declare Vars
AutoItSetOption("MustDeclareVars", 1)
;Declare Variables
Global $frmMain
;Main form menu vars
Global $frmMainFileMenu
Global $frmMainFileItemExit
;Main form source video
Global $sourceVideoLabel
Global $sourceVideoInput
Global $sourceVideoBrowseBtn
Global $ffmpegStdOutput
;FFMpeg Command Label
Global $ffmpegCommandLabel
;Create GUI
$frmMain = GUICreate("Web Video Encoder FF", 640, 480, (@DeskTopWidth - 640)/2, (@DeskTopHeight - 480)/2, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitApp")
$frmMainFileMenu = GUICtrlCreateMenu("&File")
$frmMainFileItemExit = GUICtrlCreateMenuItem("E&xit", $frmMainFileMenu)
GUICtrlSetOnEvent($frmMainFileItemExit, "ExitApp")
;Source Video Controls
$sourceVideoLabel = GUICtrlCreateLabel("Source Video: ", 5, 24, 70, 20, -1, -1)
$sourceVideoInput = GUICtrlCreateInput("",80, 20, 500, 20, -1, -1)
$sourceVideoBrowseBtn = GUICtrlCreateButton("Browse", 585, 20, 50, 20, -1, -1)
GUICtrlSetOnEvent($sourceVideoBrowseBtn, "SelectSourceVideo")
GUISetState(@SW_SHOW)
;fFFMpeg std Output Control
$ffmpegStdOutput = GUICtrlCreateEdit("", 80, 100, 500, 150, -1, -1)
;FFMpeg Command Line
;$ffmpegCommandLabel = GUICtrlCreateLabel("Command: "& $openDialog, 5, 400, 600, 20, -1, -1)
While 1
Sleep(1000)
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Function: Select Source Video.
; - Run ffmpeg to get input file info.
; - Send ffmpeg output to edit control.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func SelectSourceVideo()
Local $openDialog, $sourceFile, $ffmpegInputSwitch, $ffmpegScreenOut, $runFFmpeg
$openDialog = FileOpenDialog("Source Video", @MyDocumentsDir, "avi (*.avi)|mpeg (*.mpg;*.mpeg;*.mp4)", 1)
If @error Then
MsgBox(48, "No File Chosen", "No File Chosen.")
Return
EndIf
$sourceFile = GUICtrlSetData($sourceVideoInput, $openDialog)
$ffmpegInputSwitch = " -i """ & $openDialog & """"
$runFFmpeg = Run(FileGetShortName(@ScriptDir & "\ffmpeg.exe") & $ffmpegInputSwitch, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
$ffmpegScreenOut = ""
while 1
$ffmpegScreenOut &= StderrRead($runFFmpeg)
If @error Then ExitLoop
WEnd
GUICtrlSetData($ffmpegStdOutput, GUICtrlRead($ffmpegStdOutput) & $ffmpegScreenOut & @CRLF)
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Function: Exit Application
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func ExitApp()
Exit
EndFunc