[Gambas-user] ffmpeg locking up Shell

Bruce Steers bsteers4 at gmail.com
Wed Sep 22 02:56:54 CEST 2021


On Tue, 21 Sept 2021 at 17:12, T Lee Davidson <t.lee.davidson at gmail.com>
wrote:

> On 9/21/21 4:46 AM, Bruce Steers wrote:
> >
> > I'm trying to use ffmpeg to get the time length of a music file.
> >
> > I'm doing it like this..
> >
> > *  Shell "ffmpeg -i '" & sSoundFile & "' 2>&1|grep Duration|awk '{print
> $2}'" Wait To sVar*
> >
> > the command works fine in a terminal but my gambas app freezes on trying
> to run it?
> > I know the command outputs to error not stdout so have to use the 2>&1
> divert
> >
> > Anyone know what the problem is?
> > It's like the ffmpeg command never exits
> >
> > Cheers all
> > BruceS
> >
>
> Apparently ffmpeg is one of those programs that have a command-line
> interface that is accessible only if running inside a
> virtual terminal.
>
> Try:
> Public Sub Main()
>
>    Shell "ffmpeg -i '" & sSoundFile & "' 2>&1|grep Duration|awk '{print
> $2}'" Wait For Input As "Process"
>
> End
>
> Public Sub Process_Read()
>
>    Dim sLine As String
>
>    sLine = Read #Last, -256
>    Print sLine
>
> End
>
>
> BTW, the Wait keyword is not required when using the quick (ie. "To sVar")
> syntax.
>

Thank you kind sir that worked a treat :)

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210922/66ae171a/attachment-0001.htm>


More information about the User mailing list