[Gambas-user] Problem with MediaPipeline

Claus Dietrich claus.dietrich at freenet.de
Fri Apr 14 21:59:40 CEST 2023


Hi

I am trying to record audio from the pulse monitor device. The GStreamer 
pipe

$ gst-launch-1.0 -v pulsesrc 
device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" ! 
audio/x-raw,rate=44100,channels=2 ! lamemp3enc quality=0 target=bitrate 
bitrate=192 cbr=true ! id3v2mux ! filesink location="/home/$USER/output.mp3"

works, but I failed to setup an equivalent as Gambas MediaPipeline. The 
following code is causing an error in line enc["target"] = bitrate and 
when I uncomment the line I get an error "Cannot set status" at pl.play.

' Gambas class file
Private pl As MediaPipeline
Private src As MediaControl
Private fmt As MediaControl
Private enc As MediaControl
Private met As MediaControl
Private snk As MediaControl

Public Sub Form_Open()

   pl = New MediaPipeline
   src = New MediaControl(pl, "pulsesrc")
   src["device"] = "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
   fmt = New MediaControl(pl, "audio/x-raw,rate=44100,channels=2")
   enc = New MediaControl(pl, "lamemp3enc")
   enc["quality"] = 0
   'enc["target"] = bitrate
   enc["bitrate"] = 192
   enc["cbr"] = True
   met = New MediaControl(pl, "id3v2mux")
   snk = New MediaControl(pl, "filesink")
   snk["location"] = "/home/$USER/output.mp3"

   src.LinkTo(fmt)
   fmt.LinkTo(enc)
   enc.LinkTo(met)
   met.LinkTo(snk)

End

Public Sub Button1_Click()

   pl.play

End

Can someone help?

Best regards

Claus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230414/12105e79/attachment.htm>


More information about the User mailing list