Problems with AAC and qtdemux

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

Problems with AAC and qtdemux

Neil Jones
Im trying to play MP4 files with my AAC Decoder but im having problems.

the file im playing is 'cooper.mp4' from these samples
http://www.mp3-tech.org/tests/aac_48/samples/sample6.zip

this is a 48Khz LC-AAC with SBR (ie HE-AAC), looking a this with
qtdemux and fakesink gives:


 gst-launch -vvv filesrc location=cooper.mp4 ! qtdemux ! fakesink | more

....
caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
stream-format=(string)raw, codec_data=(buffer)139056e5a0,
rate=(int)44100, channels=(int)2
....

So as qtdemux gives us raw data (not adts or adif framed) I need to
setup my decoder on the info provided by qtdemux, unfortunatley it
gives me the wrong sample rate 44.1 instead of 48 and I need to know
that the profile has SBR as this effects my decoder setup.

How do other AAC decoders deal with this? Do they just parse the raw
data, I cant easily do this as my plugin is for a hardware decoder.

Any help appreciated,

Cheers,

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

Re: Problems with AAC and qtdemux

Remco Treffkorn
On Monday, March 19, 2012, Neil Jones wrote:

> Im trying to play MP4 files with my AAC Decoder but im having problems.
>
> the file im playing is 'cooper.mp4' from these samples
> http://www.mp3-tech.org/tests/aac_48/samples/sample6.zip
>
> this is a 48Khz LC-AAC with SBR (ie HE-AAC), looking a this with
> qtdemux and fakesink gives:
>
>
>  gst-launch -vvv filesrc location=cooper.mp4 ! qtdemux ! fakesink | more
>
> ....
> caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
> stream-format=(string)raw, codec_data=(buffer)139056e5a0,
> rate=(int)44100, channels=(int)2
> ....
>
> So as qtdemux gives us raw data (not adts or adif framed) I need to
> setup my decoder on the info provided by qtdemux, unfortunatley it
> gives me the wrong sample rate 44.1 instead of 48 and I need to know
> that the profile has SBR as this effects my decoder setup.
>
> How do other AAC decoders deal with this? Do they just parse the raw
> data, I cant easily do this as my plugin is for a hardware decoder.
>
> Any help appreciated,
>
> Cheers,
>
> Neil

Here is the output from mediainfo:

[remco@localhost sample6]$ mediainfo cooper.mp4
General
Complete name                            : cooper.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 148 KiB
Duration                                 : 24s 645ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 49.1 Kbps
Performer                                : cooper
Encoded date                             : UTC 2006-02-17 19:20:11
Tagged date                              : UTC 2006-02-17 19:20:16
Writing application                      : Nero AAC Codec 4.9.9.95

Audio
ID                                       : 1
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : HE-AAC / LC
Codec ID                                 : 40
Duration                                 : 24s 645ms
Bit rate mode                            : Variable
Bit rate                                 : 48.0 Kbps
Maximum bit rate                         : 51.2 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz / 22.05 KHz
Compression mode                         : Lossy
Stream size                              : 144 KiB (97%)
Language                                 : English
Encoded date                             : UTC 2006-02-17 19:20:11
Tagged date                              : UTC 2006-02-17 19:20:16
Material_Duration                        : 24648
Material_Duration_LastFrame              : -11
Material_StreamSize                      : 146949


Please note that the bit rate is 48kb but the sampling rate is 44.1 KHz.

Cheers,
Remco

--
Remco Treffkorn (RT445)
HAM DC2XT
[hidden email]   (831) 685-1201

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

Re: Problems with AAC and qtdemux

Tim-Philipp Müller-2
In reply to this post by Neil Jones
On Mon, 2012-03-19 at 15:31 +0000, Neil Jones wrote:

> this is a 48Khz LC-AAC with SBR (ie HE-AAC), looking a this with
> qtdemux and fakesink gives:
>
>
>  gst-launch -vvv filesrc location=cooper.mp4 ! qtdemux ! fakesink | more
>
> ....
> caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
> stream-format=(string)raw, codec_data=(buffer)139056e5a0,
> rate=(int)44100, channels=(int)2
> ....
>
> So as qtdemux gives us raw data (not adts or adif framed) I need to
> setup my decoder on the info provided by qtdemux, unfortunatley it
> gives me the wrong sample rate 44.1 instead of 48 and I need to know
> that the profile has SBR as this effects my decoder setup.
>
> How do other AAC decoders deal with this? Do they just parse the raw
> data, I cant easily do this as my plugin is for a hardware decoder.

You can get that information from the "codec_data" buffer in the caps,
which is basically codec setup data. It's the same as the "esds" atom in
a quicktime/isomp4 container.

 Cheers
  -Tim

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

Re: Problems with AAC and qtdemux

Sudarshan Bisht
In reply to this post by Neil Jones
You can also build ADTS header and attach it with every frame, following link gives information about ADTS header;
http://wiki.multimedia.cx/index.php?title=ADTS 

On Mon, Mar 19, 2012 at 9:01 PM, Neil Jones <[hidden email]> wrote:
Im trying to play MP4 files with my AAC Decoder but im having problems.

the file im playing is 'cooper.mp4' from these samples
http://www.mp3-tech.org/tests/aac_48/samples/sample6.zip

this is a 48Khz LC-AAC with SBR (ie HE-AAC), looking a this with
qtdemux and fakesink gives:


 gst-launch -vvv filesrc location=cooper.mp4 ! qtdemux ! fakesink | more

....
caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
stream-format=(string)raw, codec_data=(buffer)139056e5a0,
rate=(int)44100, channels=(int)2
....

So as qtdemux gives us raw data (not adts or adif framed) I need to
setup my decoder on the info provided by qtdemux, unfortunatley it
gives me the wrong sample rate 44.1 instead of 48 and I need to know
that the profile has SBR as this effects my decoder setup.

How do other AAC decoders deal with this? Do they just parse the raw
data, I cant easily do this as my plugin is for a hardware decoder.

Any help appreciated,

Cheers,

Neil
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



--
Regards,

Sudarshan Bisht

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

Re: Problems with AAC and qtdemux

Neil Jones
In reply to this post by Tim-Philipp Müller-2
Cheers for the replies guys,

the codec_data buffer provided in the caps looks promising ( i just
assumed this was the address of the first buffer ).

This appears to be just an address, can I just dereference this ? are
there any buffer ownership issues I need to be aware of ?

Cheers

Neil





On Mon, Mar 19, 2012 at 6:22 PM, Tim-Philipp Müller <[hidden email]> wrote:

> On Mon, 2012-03-19 at 15:31 +0000, Neil Jones wrote:
>
>> this is a 48Khz LC-AAC with SBR (ie HE-AAC), looking a this with
>> qtdemux and fakesink gives:
>>
>>
>>  gst-launch -vvv filesrc location=cooper.mp4 ! qtdemux ! fakesink | more
>>
>> ....
>> caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
>> stream-format=(string)raw, codec_data=(buffer)139056e5a0,
>> rate=(int)44100, channels=(int)2
>> ....
>>
>> So as qtdemux gives us raw data (not adts or adif framed) I need to
>> setup my decoder on the info provided by qtdemux, unfortunatley it
>> gives me the wrong sample rate 44.1 instead of 48 and I need to know
>> that the profile has SBR as this effects my decoder setup.
>>
>> How do other AAC decoders deal with this? Do they just parse the raw
>> data, I cant easily do this as my plugin is for a hardware decoder.
>
> You can get that information from the "codec_data" buffer in the caps,
> which is basically codec setup data. It's the same as the "esds" atom in
> a quicktime/isomp4 container.
>
>  Cheers
>  -Tim
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with AAC and qtdemux

Tim-Philipp Müller-2
On Tue, 2012-03-20 at 11:05 +0000, Neil Jones wrote:

> the codec_data buffer provided in the caps looks promising ( i just
> assumed this was the address of the first buffer ).
>
> This appears to be just an address, can I just dereference this ? are
> there any buffer ownership issues I need to be aware of ?
>
>
> >> caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true,
> >> stream-format=(string)raw, codec_data=(buffer)139056e5a0,
> >> rate=(int)44100, channels=(int)2
> >> ....

It's not an address. Those are actually 5 bytes in hex notation.

You can get to the buffer via:

GstStructure *s;
const GValue *value;

s = gst_caps_get_structure (caps, 0);
value = gst_structure_get_value (structure, "codec_data");
if (value != NULL) {
  GstBuffer *codec_data;
  const guint8 *data;
  guint data_size;

  codec_data = gst_value_get_buffer (value);
  data = GST_BUFFER_DATA (codec_data);
  data_size = GST_BUFFER_SIZE (codec_data);

  gst_util_dump_mem (data, data_size);
}

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel