[Lazarus] Problems using RunCommandIndir with Lazarus 2.0.0

info at voiceliveeditor.com info at voiceliveeditor.com
Tue Mar 5 20:57:58 CET 2019

Just done a quick google,
would telling ffmpeg to log output to errlog or nul help.


Just a thiught


-----Original Message----- 
From: Bo Berglund via lazarus
Sent: Tuesday, March 5, 2019 7:48 PM
To: lazarus at lists.lazarus.freepascal.org
Cc: Bo Berglund
Subject: Re: [Lazarus] Problems using RunCommandIndir with Lazarus 2.0.0

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

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

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

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;
  arguments: array of string;
  returnstr: string;
  executable: string;
  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]);

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

Bo Berglund
Developer in Sweden

lazarus mailing list
lazarus at lists.lazarus-ide.org

More information about the lazarus mailing list