[Gambas-user] gstreamer and aac format
vuott at tutanota.com
vuott at tutanota.com
Thu Jan 11 19:52:52 CET 2024
Uhmmm.... for example from WAV to AAC:
[code]
Private bo As Boolean
Public Sub Main()
Dim fileaudio, appoggio As String
Dim pl As MediaPipeline
Dim src, wav, cnv, faac, snk As MediaControl
Dim flt As MediaFilter
fileaudio = "/path/of/file.wav"
appoggio = Temp
pl = New MediaPipeline As "PLine"
src = New MediaControl(pl, "filesrc")
src["location"] = fileaudio
wav = New MediaControl(pl, "wavparse")
cnv = New MediaControl(pl, "audioconvert")
faac = New MediaControl(pl, "faac")
flt = New MediaFilter(pl, "audio/mpeg,stream-format=adts")
snk = New MediaControl(pl, "filesink")
snk["location"] = appoggio
src.LinkTo(wav)
wav.LinkTo(cnv)
cnv.LinkTo(faac)
faac.LinkTo(flt)
flt.LinkTo(snk)
pl.Play()
While pl.Duration < 1
Wait 0.01
Wend
Print "Wav file duration: "; Time(0, 0, 0, pl.Duration * 1000)
Repeat
Write "\r\e[0mConversion timelapsed: \e[31m" & Time(0, 0, 0, pl.Position * 1000) Wait 0.01
Until bo
Copy appoggio To "/tmp" &/ File.BaseName(fileaudio) & ".aac"
pl.Stop
pl.Close
Print "\n\e[0mConversion completed !"
End
Public Sub PLine_End() ' This Event is raised, when the conversion is finished
bo = True
End
[/code]
11 gen 2024, 13:33 da 64xcode at gmail.com:
> Hi,
>
> I'm trying to record audio in aac format [1] with gstreamer using a class that Claus kindly shared with me.
> I have tried some of the plugins listed on the gstreamer site [2] but I can't get the audio in that format.
> Any idea?
> I leave the class as an attachment in case anyone wants to do some testing.
>
> [1] https://en.wikipedia.org/wiki/Advanced_Audio_Coding
>
> [2] https://gstreamer.freedesktop.org/documentation/plugins_doc.html?gi-language=c
>
> Thanks.
>
> Martin.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240111/c74e4697/attachment.htm>
More information about the User
mailing list