Hello,
I'm doing some testing with ffmpeg for a screenshot.
I can start the ffmpeg program,
but I can't program it to shut down properly.
with the keyboard the letter 'q' ends the program correctly.
Windows 10-64 Lazarus 2.0.8 32bit
Thanks,
procedure RunFFmpeg(const params: string);
begin
if P.Running then
Exit;
P.Parameters.Clear;
P.InheritHandles := False;
P.Executable := ('ffmpeg.exe');
P.Parameters.Add((params));
// P.Options := [poWaitOnExit, poStderrToOutPut, poNoConsole ];
P.Options := [poUsePipes];
P.Execute;
end;
procedure TForm1.BpStartClick(Sender: TObject);
begin
RunFFmpeg('-f gdigrab -framerate 10 -to 20 -i desktop -y "output.mkv"');
end;
procedure TForm1.BpStopClick(Sender: TObject);
var
st: string;
begin
if p.Running then
begin
// P.Terminate(0); exit;
st := 'q' + Lineending;
p.input.Write(st[1], length(st));
end;
end;
initialization
P := TProcess.Create(nil);
finalization
P.Free;
end.