correct way to decode AAC?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

correct way to decode AAC?

Adams, Bruce (KMLWG)

Hi,

     What is the correct way to decode aac audio from an mpeg TS?

I have a pipeline like this:

 

>gst-launch-1.0 -v filesrc location=multi.ts ! tsparse ! tsdemux program_number=17540 ! aacparse ! faad ! audioconvert ! audioresample ! audio/x-raw, rate=8000, channels=1 ! wavenc ! filesink location=cbbc.wav

Setting pipeline to PAUSED ...

Pipeline is PREROLLING ...

/GstPipeline:pipeline0/MpegTSParse2:mpegtsparse2-0.GstPad:src: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188

/GstPipeline:pipeline0/GstTSDemux:tsdemux0.GstPad:sink: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188

WARNING: from element /GstPipeline:pipeline0/GstTSDemux:tsdemux0: Delayed linking failed.

Additional debug info:

./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstTSDemux:tsdemux0:

failed delayed linking some pad of GstTSDemux named tsdemux0 to some pad of GstAacParse named aacparse0

^Chandling interrupt.

Interrupt: Stopping pipeline ...

ERROR: pipeline doesn't want to preroll.

Setting pipeline to NULL ...

Freeing pipeline ...

 

So I tried just saving the raw AAC to a file and converting that as an experiment:

 

>gst-launch-1.0 -v filesrc location=multi.ts ! tsparse ! tsdemux program_number=17540 ! audio/mpeg ! filesink location=cbbc.aac

 

>mediainfo cbbc.aac

General

Complete name                            : cbbc.aac

Format                                   : LATM

File size                                : 2.38 MiB

Overall bit rate mode                    : Variable

 

Audio

Format                                   : AAC

Format/Info                              : Advanced Audio Codec

Format profile                           : LC

Bit rate mode                            : Variable

Channel(s)                               : 2 channels

Channel positions                        : Front: L R

Sampling rate                            : 48.0 kHz

Frame rate                               : 46.875 FPS (1024 spf)

Compression mode                         : Lossy

 

This audio file plays fine in for example VLC

 

However I cannot decode it:

 

>gst-launch-1.0 -v filesrc location=cbbc.aac ! aacparse ! faad ! audioconvert ! audioresample ! audio/x-raw, rate=8000, channels=1 ! wavenc ! filesink location=cbbc.wav

Setting pipeline to PAUSED ...

Pipeline is PREROLLING ...

/GstPipeline:pipeline0/GstAacParse:aacparse0.GstPad:src: caps = audio/mpeg, framed=(boolean)true, mpegversion=(int)4, rate=(int)48000, channels=(int)2, stream-format=(string)loas

ERROR: from element /GstPipeline:pipeline0/GstAacParse:aacparse0: Internal data stream error.

Additional debug info:

gstbaseparse.c(3608): gst_base_parse_loop (): /GstPipeline:pipeline0/GstAacParse:aacparse0:

streaming stopped, reason not-negotiated (-4)

ERROR: pipeline doesn't want to preroll.

Setting pipeline to NULL ...

 

What am I missing here?

 

Regards,

 

Bruce.



Kantar Disclaimer
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: correct way to decode AAC?

devil coder
Hi bruce,,

for audio decoding to wav format.
Hope this example works for you(i have tested it )

gst-launch-1.0 filesrc location=out.aac ! queue ! aacparse ! faad !
audioconvert ! wavenc ! filesink location=file.wav



-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

Adams, Bruce (KMLWG)
Hi,
     That’s the same pipeline I'm using except you've added a queue.
I tried it anyway in case queue are 'more magical than I  think' but perhaps unsurprisingly
it doesn't work for me.
Could it be something to do with the format. Mediainfo claims the general format is:

General
Complete name                            : cbbc.aac
Format                                   : LATM
File size                                : 2.38 MiB
Overall bit rate mode                    : Variable

Audio
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 spf)
Compression mode                         : Lossy

What format did you test?

Regards,

Bruce.

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of new baby
Sent: 22 May 2018 06:20
To: [hidden email]
Subject: Re: correct way to decode AAC?

Hi bruce,,

for audio decoding to wav format.
Hope this example works for you(i have tested it )

gst-launch-1.0 filesrc location=out.aac ! queue ! aacparse ! faad !
audioconvert ! wavenc ! filesink location=file.wav



-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

Adams, Bruce (KMLWG)
In reply to this post by Adams, Bruce (KMLWG)
It looks like the avdec_aac_latm element was what I was looking for:

>$ gst-inspect-1.0 | grep aac  

On a related note is it possible to construct a single pipeline that supports both decodings
as in:      

aac -> avdec_aac_latm --> wavenc
        -> faad                         -^

Is there an selectable/'or' element? as in the brackets below:

gst-launch-1.0 wavenc name=y ! filesink location=file.wav \
 filesrc location=out.aac name  x. ! aacparse ! (faad | avdec_aac_latm) !
audioconvert ! .y

or Something like:

gst-launch-1.0 wavenc name=y ! filesink location=file.wav \
 filesrc location=out.aac name  x. ! aacparse ! avdec_aac_latm !
audioconvert ! .y

which doesn't work - doubled to:

gst-launch-1.0 wavenc name=y ! filesink location=file.wav \
 filesrc location=out.aac name  \
x. ! aacparse ! avdec_aac_latm ! audioconvert ! .y
x. ! aacparse ! faad ! audioconvert ! .y


I do have access to information that identifies the stream type (its in the program mapping table in a DVB MPEG-TS) but I'm curious to know whether a generic pipeline is possible in principle either from the command line or from code.

Would it be a desirable patch to create an element combining both somehow (maybe a bin)?
Or is it better to be creating the pipeline dynamically once the type has been identified which I think is the only solution without changing gstreamer.

Regards,

Bruce.

-----Original Message-----
From: Adams, Bruce (KMLWG)
Sent: 22 May 2018 14:16
To: [hidden email]
Subject: RE: correct way to decode AAC?

Hi,
     That’s the same pipeline I'm using except you've added a queue.
I tried it anyway in case queue are 'more magical than I  think' but perhaps unsurprisingly
it doesn't work for me.
Could it be something to do with the format. Mediainfo claims the general format is:

General
Complete name                            : cbbc.aac
Format                                   : LATM
File size                                : 2.38 MiB
Overall bit rate mode                    : Variable

Audio
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 spf)
Compression mode                         : Lossy

What format did you test?

Regards,

Bruce.

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of new baby
Sent: 22 May 2018 06:20
To: [hidden email]
Subject: Re: correct way to decode AAC?

Hi bruce,,

for audio decoding to wav format.
Hope this example works for you(i have tested it )

gst-launch-1.0 filesrc location=out.aac ! queue ! aacparse ! faad !
audioconvert ! wavenc ! filesink location=file.wav


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

devil coder
In reply to this post by Adams, Bruce (KMLWG)
Hi bruce,


*I suggest you convert to mp3 and then wav file.*

1) second approche (i have tested it ..)

gst-launch-1.0 filesrc location=Transformers1080p.ts ! tsdemux name=demux
demux. ! queue ! faad ! lamemp3enc quality=2 target=bitrate bitrate=192
cbr=true ! id3v2mux ! filesink location=file.mp3

        gst-launch-1.0 filesrc location=file.mp3 ! queue ! decodebin  !
audioconvert ! wavenc ! filesink location=file.wav
       


2) Format  of my .aac file
<http://gstreamer-devel.966125.n4.nabble.com/file/t378175/aac.png>









-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

devil coder
from mediainfo ...the aac format is ADTS..i have extracted aac from .ts from
ffmpeg

 but do as .mp3 to .wav tested and working .

General
Complete name                            :
E:\pocVR\VCS\VCS\Race3SalmanKhan720p.aac
Format                                   : ADTS
Format/Info                              : Audio Data Transport Stream
File size                                : 3.29 MiB
Overall bit rate mode                    : Variable

Audio
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 4
Format profile                           : LC
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 3.29 MiB (100%)




-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

devil coder
Found the BEST way Directly convert .ts to .wav file like this ...
Hope it solves all your worries



*gst-launch-1.0 filesrc location=Transformers1080p.ts ! queue ! decodebin  !
audioconvert ! wavenc ! filesink location=file.wav *





-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

Adams, Bruce (KMLWG)
What is the purpose of the queue in that pipeline?

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of new baby
Sent: 23 May 2018 12:54
To: [hidden email]
Subject: RE: correct way to decode AAC?

Found the BEST way Directly convert .ts to .wav file like this ...
Hope it solves all your worries



*gst-launch-1.0 filesrc location=Transformers1080p.ts ! queue ! decodebin  !
audioconvert ! wavenc ! filesink location=file.wav *





-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

devil coder
its not mandatory, you can remove it and check .. i guess it will work too
without queue



-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi
Reply | Threaded
Open this post in threaded view
|

RE: correct way to decode AAC?

Adams, Bruce (KMLWG)
In reply to this post by Adams, Bruce (KMLWG)
The decodebin element is perhaps a bit of overkill here.
Consider this pipeline:

gst-launch-1.0 -v filesrc location=multi.ts ! tsparse ! tsdemux program_number=17540 ! decodebin ! audioconvert ! audioresample ! audio/x-raw, rate=8000, channels=1 ! wavenc ! filesink location=cbbc.wav

I get the error:

Missing element: H.264 decoder
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Your GStreamer installation is missing a plug-in.
Additional debug info:
gstdecodebin2.c(4592): gst_decode_bin_expose (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:

There are patent issues with H264 but yes it would be nice to fix my install.

My point though is that I don't care about the video in this pipeline.
I really just want an "OR" element

Try decoding using A or B
E.g.

Src = audio/mpeg
Sink = audio/x-raw

If src=AAC use avdec_aac
If src=MPEG use faad

Of course the decodebin element gives us that and more
but is there a standard way of doing this or a case for something leaner?

Regards,

Bruce.

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of Adams, Bruce (KMLWG)
Sent: 23 May 2018 12:57
To: Discussion of the development of and with GStreamer
Subject: RE: correct way to decode AAC?

What is the purpose of the queue in that pipeline?

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of new baby
Sent: 23 May 2018 12:54
To: [hidden email]
Subject: RE: correct way to decode AAC?

Found the BEST way Directly convert .ts to .wav file like this ...
Hope it solves all your worries



*gst-launch-1.0 filesrc location=Transformers1080p.ts ! queue ! decodebin  !
audioconvert ! wavenc ! filesink location=file.wav *





-----
adi
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel