Hi! I was looking for a solution to my problem and realized that this is a bug. But I did not lose hope and found an option in ffmpeg -progress which can transfer the data I need to post requests or write to a text file. I wrote two working examples and can not decide which method is preferable.
Code: Select all
Procedure Server(param)
InitNetwork()
CreateNetworkServer(10, 1111)
Protected Buffersize = 16
Protected SEvent,Result,ClientID,msg$
Protected *Buffer = AllocateMemory(Buffersize)
Protected d.i = 0
Debug "Started server"
Repeat
SEvent = NetworkServerEvent()
Delay(100)
Select SEvent
Case #PB_NetworkEvent_Connect
Debug "A new client has connected! " + Str(EventClient())
Case #PB_NetworkEvent_Data
Repeat
ClientID = EventClient()
Result = ReceiveNetworkData(ClientID, *Buffer, Buffersize)
If Result
msg$ = msg$+PeekS(*Buffer, Result,#PB_Ascii)
Else
Debug "Just did a non-blocking read of 0 bytes."
EndIf
Until Result <> Buffersize
Debug "client: " + msg$ + " from " + Str(ClientID)
msg$ =""
Case #PB_NetworkEvent_Disconnect
Debug Str(EventClient()) + " disconnected."
EndSelect
ForEver
EndProcedure
Procedure RoutineCoding(str$)
Protected prog, Output.s, out.s
OpenFile(0, "1.txt",#PB_File_SharedWrite)
prog = RunProgram("ffmpeg.exe",str$ + " -progress http://127.0.0.1:1111/", "", #PB_Program_Open | #PB_Program_Wait)
Delay(200)
EndProcedure
CreateThread (@Server(),1)
RoutineCoding("-i 1.m2v -c:v libx265 -an -x265-params crf=20 -y OUT.mov")
Code: Select all
Procedure RoutineCoding(str$)
Protected prog, Output.s, out.s
OpenFile(0, "1.txt",#PB_File_SharedWrite)
prog = RunProgram("ffmpeg.exe",str$ + " -progress 1.txt", "", #PB_Program_Open )
While ProgramRunning(prog)
Output = ReadString(0)
If Output
Debug Output
If Left(Output,9)="progress=":FileSeek(0,0):TruncateFile(0):EndIf
EndIf
Wend
CloseFile(0)
EndProcedure
RoutineCoding("-i 1.avi -c:v libx265 -an -x265-params crf=25 -y OUT.mov")