[Lazarus] Problems using RunCommandIndir with Lazarus 2.0.0

Bo Berglund bo.berglund at gmail.com
Tue Mar 5 20:48:58 CET 2019


On Sat, 02 Mar 2019 09:56:07 +0100, Bo Berglund via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>Now for another RunCommandInDir problem:
>----------------------------------------
>When I run the command to extract the information a black command
>window is briefly flashed on screen and then disappears.
>
>Is there some way to make this window minimized or invisible while it
>runs?

So I have solved the general problems of using RunCommandInDir with
ffmpeg. It does work.

But if I command a video edit with multiple cuts being extracted and
later combined there is a succession of many black command windows
being shown on top of the main GUI form for a fraction of a second up
to a couple of seconds.
It really looks very ugly.

Is there absolutely no way to hide or minimize these windows during
execution?

I am using Lazarus 2.0.0 with fpc 3.0.4 (64 bit versions) in Windows 7
x64.

This is till a problem that fits the topic of this thread...

This is the function I call in a loop once for each cutout part of the
video file:

function ExtractVideoSection(InputFile, OutputFile: string; Start,
Duration: integer; OverwriteOutput: boolean = true): boolean;
var
  arguments: array of string;
  returnstr: string;
  executable: string;
begin
  Result := false;
  if not FileExists(InputFile) then exit;
  if (not OverwriteOutput) and FileExists(OutputFile) then exit;

  if FileExists(OutputFile) then DeleteFile(OutputFile);

  SetLength(arguments, 10);
  executable := 'ffmpeg.exe';
  arguments[0] := '-ss';
  arguments[1] := FormatTimeDiff(Start);
  arguments[2] := '-i';
  arguments[3] := InputFile;
  arguments[4] :=  '-to';
  arguments[5] :=  FormatTimeDiff(Duration);
  arguments[6] :=  '-c';
  arguments[7] :=  'copy';
  arguments[8] :=  OutputFile;
  arguments[9] :=  '-hide_banner';

  Result := RunCommandIndir(ExtractFileDir(OutputFile), executable,
arguments, returnstr, [poWaitOnExit,poStderrToOutPut]);
end;

Every invocation of RunCommandInDir() causes a command window to be
shown on screen.


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list