[Gambas-user] gstreamer and aac format
vuott at tutanota.com
vuott at tutanota.com
Thu Jan 11 22:52:56 CET 2024
...but the request wanted the audio to be recorded in an AAC format file:
[code]
Private bo As Boolean
Public Sub Main()
Dim appoggio As String
Dim pl As MediaPipeline
Dim src, cnv, faac, snk As MediaControl
Dim flt As MediaFilter
appoggio = Temp
pl = New MediaPipeline
src = New MediaControl(pl, "alsasrc")
cnv = New MediaControl(pl, "audioconvert")
faac = New MediaControl(pl, "faac")
flt = New MediaFilter(pl, "audio/mpeg,stream-format=adts,channels=2,rate=44100")
snk = New MediaControl(pl, "filesink")
snk["location"] = appoggio
src.LinkTo(cnv)
cnv.LinkTo(faac)
faac.LinkTo(flt)
flt.LinkTo(snk)
pl.Play()
While Not bo
Write "\r\e[0mTimelapsed: \e[31m" & Time(0, 0, 0, pl.Position * 1000) Wait 0.01
Wend
Copy appoggio To "/tmp/file.aac"
pl.Stop
pl.Close
Quit
End
Public Sub Application_Read() ' This Event is raised, when you press "Enter" keys on the keyboard
bo = True
End
[/code]
11 gen 2024, 19:53 da user at lists.gambas-basic.org:
> 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[0m> 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[0m> Conversion> > 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/ed3ad905/attachment.htm>
More information about the User
mailing list