[Gambas-user] Shell comand + FFMPEG from gambas how to

T Lee Davidson t.lee.davidson at gmail.com
Sat Oct 21 06:22:41 CEST 2023


On 10/20/23 17:44, Martín wrote:
> Hi,
> 
> If I do this in the terminal it works:
> 
> ffmpeg -f pulse -i alsa_output.BLABLABLA.analog-stereo.monitor -i <(arecord -f CD) -filter_complex amix -acodec libmp3lame 
> output.mp3
> 
> But if I do the same although Shell inside the gamabs code it doesn't work.
> 
> What I'm doing wrong? here is the sample code. The idea behind is record 2 audio tracks at the same time one for the micro and 
> other for the internal audio output.
> 
> Private hMicro As Process
> Private hSystem As Process
> 
> Public Sub bRecord_Click()
> 
>    If bRecord.Value Then
>      Record()
>    Else
>      Try hMicro.Kill
>      Try hSystem.Kill
>    Endif
> 
> End
> 
> Private Sub Record()
> 
>    Dim sBase As String
>    Dim sMicro As String
>    Dim sSystem As String
> 
>    sBase = Format(Now(), "yyyy_mm_dd_hhnnss")
>    sMicro = "ffmpeg -f pulse -i alsa_input.BLABLABLA.analog-stereo -acodec libmp3lame " & sBase & "_micro.mp3"
>    sSystem = "ffmpeg -f pulse -i alsa_output.BLABLABLA.analog-stereo.monitor -i <(arecord -f CD) -filter_complex amix -acodec 
> libmp3lame " & sBase & "_system.mp3"
> 
>    hMicro = Shell sMicro For Read As "RMicro"
>    hSystem = Shell sSystem For Read As "RSystem"
> 
> End
> 
> I was thinking to sent the Shell command in a direct way, without start a process first, but how I can kill the process, in the 
> good way, later? Actually I use "killall ffmpeg"
> 
> Second point: it is possible sent 2 commands with ffmpeg? because I sent the first one and then the second one never occur.

What, exactly, "doesn't work"?
Is no MP3 file created?
Is your Read event handler never triggered?

Perhaps EXEC might work better.


-- 
Lee



More information about the User mailing list