[PATCH] DVB LATM parser
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id. With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library. I would welcome comments and suggestions so this can be included in the ffmpeg codebase. Cheers, Paul Kendall
2008/7/3 Paul Kendall <paul at kcbbs.gen.nz>:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
I know you're probably aware of some of these comments and I'll let someone more experienced/knowledgeable comment but I have a few comments of my own which they and you may wish to consider: - I don't think it should be implemented as a codec but rather as a bitstream parser or demuxer as appropriate. I need to reread the spec for LATM but at the moment I'm not sure if generic LATM can handle multiple audio streams. I understand the DVB implementation only uses one. If it can use more then ideally they should be presentable in the output of `ffmpeg -i infile` like other streams. This may decide whether a bitstream parser or demuxer is better. - I suspect some of the functions (GASpecificConfig, AudioSpecificConfig, etc) should be shared. Some may exist in our own AAC decoder (not yet in SVN, only in SoC SVN so you can't be held accountable for not coding with this in mind :)) and others in libavcodec/aac_parser.c, libavcodec/mpeg4audio.c or so. It would probably be better to add the LATM functionality to what we have than to duplicate these functions with slight alterations for LATM. - Is using get_bits and put_bits the best approach for this? It seems a little weird to me to parse the stream, rewrite it, then parse it again but maybe this is best. Regards, Rob
On Friday 04 July 2008 01:52:37 Robert Swain wrote:
2008/7/3 Paul Kendall <paul at kcbbs.gen.nz>:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
I know you're probably aware of some of these comments and I'll let someone more experienced/knowledgeable comment but I have a few comments of my own which they and you may wish to consider:
- I don't think it should be implemented as a codec but rather as a bitstream parser or demuxer as appropriate. I need to reread the spec for LATM but at the moment I'm not sure if generic LATM can handle multiple audio streams. I understand the DVB implementation only uses one. If it can use more then ideally they should be presentable in the output of `ffmpeg -i infile` like other streams. This may decide whether a bitstream parser or demuxer is better.
I have written it as a parser. It is also specifically for DVB, so it only handles 1 stream. If I extend it later to handle multiple streams I will certainly look at writing it as a demuxer.
- I suspect some of the functions (GASpecificConfig, AudioSpecificConfig, etc) should be shared. Some may exist in our own AAC decoder (not yet in SVN, only in SoC SVN so you can't be held accountable for not coding with this in mind :)) and others in libavcodec/aac_parser.c, libavcodec/mpeg4audio.c or so. It would probably be better to add the LATM functionality to what we have than to duplicate these functions with slight alterations for LATM.
The parser is purely LATM and really doesn't know anything about AAC, so it can be used for other embedded audio types. All you would have to do is to add another descriptor. What's the GSoC project url? I will take a look at it and see if I can share some of the structures.
- Is using get_bits and put_bits the best approach for this? It seems a little weird to me to parse the stream, rewrite it, then parse it again but maybe this is best.
The parser completely removes the LATM wrapping, so just the raw audio stream is sent to the decoder, so no duplicate parsing involved.
Regards, Rob
Cheers, Paul
2008/7/4 Paul Kendall <paul at kcbbs.gen.nz>:
On Friday 04 July 2008 01:52:37 Robert Swain wrote:
2008/7/3 Paul Kendall <paul at kcbbs.gen.nz>: - I suspect some of the functions (GASpecificConfig, AudioSpecificConfig, etc) should be shared. Some may exist in our own AAC decoder (not yet in SVN, only in SoC SVN so you can't be held accountable for not coding with this in mind :)) and others in libavcodec/aac_parser.c, libavcodec/mpeg4audio.c or so. It would probably be better to add the LATM functionality to what we have than to duplicate these functions with slight alterations for LATM.
The parser is purely LATM and really doesn't know anything about AAC, so it can be used for other embedded audio types. All you would have to do is to add another descriptor.
What's the GSoC project url? I will take a look at it and see if I can share some of the structures.
svn co svn://svn.mplayerhq.hu/soc/aac Regards, Rob
On Friday 04 July 2008 13:13:04 Robert Swain wrote:
svn co svn://svn.mplayerhq.hu/soc/aac
Cool, thanks Rob
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter .... besides the code below is exploitable [...]
+static void readPayloadLengthInfo(AACParser *parser, GetBitContext *b) +{ + uint8_t tmp; + if (parser->frameLengthType == 0) { + parser->muxSlotLengthBytes = 0; + do { + tmp = get_bits(b, 8); + parser->muxSlotLengthBytes += tmp; + } while (tmp == 255); + } else { + if (parser->frameLengthType == 5 || + parser->frameLengthType == 7 || + parser->frameLengthType == 3) { + get_bits(b, 2); + } + } +} [...] + readPayloadLengthInfo(parser, b); + + // copy data + for (j=0; j<parser->muxSlotLengthBytes; j++) + *payload++ = get_bits(b, 8); + *payloadsize = parser->muxSlotLengthBytes; [...]
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I hate to see young programmers poisoned by the kind of thinking Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this. Also, can the mpegts code use a filter or will I have to look at making it support that too?
besides the code below is exploitable
[...]
+static void readPayloadLengthInfo(AACParser *parser, GetBitContext *b) +{ + uint8_t tmp; + if (parser->frameLengthType == 0) { + parser->muxSlotLengthBytes = 0; + do { + tmp = get_bits(b, 8); + parser->muxSlotLengthBytes += tmp; + } while (tmp == 255); + } else { + if (parser->frameLengthType == 5 || + parser->frameLengthType == 7 || + parser->frameLengthType == 3) { + get_bits(b, 2); + } + } +}
[...]
+ readPayloadLengthInfo(parser, b); + + // copy data + for (j=0; j<parser->muxSlotLengthBytes; j++) + *payload++ = get_bits(b, 8); + *payloadsize = parser->muxSlotLengthBytes;
[...]
The exploit is that you could craft a packet that copies huge chunks of memory to the output? i.e. the for loop is not checking that it overflow the GetBitContext b? Cheers, Paul
Hi On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ... Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ... The idea is that the parser would split frames but not discard anything the bitstream filter then would discard the LATM wraper. I hope that will work out like that, LATM is a rather ugly thing.
Also, can the mpegts code use a filter or will I have to look at making it support that too?
any demuxer should be useable with the bitstream filter. Note though we do not yet have code to automatically enable bitstream filters, they have to be enabled by the user explicitly currently.
besides the code below is exploitable
[...]
+static void readPayloadLengthInfo(AACParser *parser, GetBitContext *b) +{ + uint8_t tmp; + if (parser->frameLengthType == 0) { + parser->muxSlotLengthBytes = 0; + do { + tmp = get_bits(b, 8); + parser->muxSlotLengthBytes += tmp; + } while (tmp == 255); + } else { + if (parser->frameLengthType == 5 || + parser->frameLengthType == 7 || + parser->frameLengthType == 3) { + get_bits(b, 2); + } + } +}
[...]
+ readPayloadLengthInfo(parser, b); + + // copy data + for (j=0; j<parser->muxSlotLengthBytes; j++) + *payload++ = get_bits(b, 8); + *payloadsize = parser->muxSlotLengthBytes;
[...]
The exploit is that you could craft a packet that copies huge chunks of memory to the output?
yes
i.e. the for loop is not checking that it overflow the GetBitContext b?
overflowing whatever payload points too ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator
Micheal, Sorry for the long delay in this! Been really busy with other things. Now there is a bit of noise on the MythTV lists about this so I thought it time that I get back to it. On Thursday 18 September 2008 06:24:48 Michael Niedermayer wrote:
Hi
On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ...
Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ...
The parser needs to be modified to handle the LATM wrapping and packetize the stream. Should the parser also set the extradata so the decoder can use that to set the channels, sample rate & sample size? or should this be left to the bitstream filter? The bitstream filter should just check the LATM wrapping and remove if present. The decoder then gets raw AAC data and all the parameters have been set by the parser and so it should all work fine. Is that the plan? Paul
On Sun, Feb 1, 2009 at 4:37 AM, Paul Kendall <paul at kcbbs.gen.nz> wrote:
Micheal, Sorry for the long delay in this! Been really busy with other things. Now there is a bit of noise on the MythTV lists about this so I thought it time that I get back to it.
On Thursday 18 September 2008 06:24:48 Michael Niedermayer wrote:
Hi
On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote:
Hi attached is a patch that provides a AAC LATM parser CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is also patched to provide another codec the decoding for this codec id. There are minor patches to mpeg.c & mpegts.c to send stream id 0x11 to this codec id.
With this patch I can get audio working perfectly for NZ DVB-T using the stock unpatched libfaad2 library.
I would welcome comments and suggestions so this can be included in the ffmpeg codebase.
Cheers, Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ...
Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ...
The parser needs to be modified to handle the LATM wrapping and packetize the stream. Should the parser also set the extradata so the decoder can use that to set the channels, sample rate & sample size? or should this be left to the bitstream filter?
The bitstream filter should just check the LATM wrapping and remove if present.
The decoder then gets raw AAC data and all the parameters have been set by the parser and so it should all work fine.
Is that the plan?
Hi Paul, Is there any update on this? the approach sounds about right -- Regards, Jai
On Thursday 12 February 2009 00:53:21 Jai Menon wrote:
On Sun, Feb 1, 2009 at 4:37 AM, Paul Kendall <paul at kcbbs.gen.nz> wrote:
Micheal, Sorry for the long delay in this! Been really busy with other things. Now there is a bit of noise on the MythTV lists about this so I thought it time that I get back to it.
On Thursday 18 September 2008 06:24:48 Michael Niedermayer wrote:
Hi
On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote:
On Thursday 03 July 2008 22:16:56 Paul Kendall wrote: > Hi attached is a patch that provides a AAC LATM parser > CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is > also patched to provide another codec the decoding for this > codec id. There are minor patches to mpeg.c & mpegts.c to send > stream id 0x11 to this codec id. > > With this patch I can get audio working perfectly for NZ DVB-T > using the stock unpatched libfaad2 library. > > I would welcome comments and suggestions so this can be included > in the ffmpeg codebase. > > Cheers, > Paul Kendall
Doh! I missed a vital part of the patch! Putting the codec in the allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ...
Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ...
The parser needs to be modified to handle the LATM wrapping and packetize the stream. Should the parser also set the extradata so the decoder can use that to set the channels, sample rate & sample size? or should this be left to the bitstream filter?
The bitstream filter should just check the LATM wrapping and remove if present.
The decoder then gets raw AAC data and all the parameters have been set by the parser and so it should all work fine.
Is that the plan?
Hi Paul, Is there any update on this? the approach sounds about right I was waiting to hear back from one of the devs as whether this is the right approach. I am keen to get this sorted ASAP as it is necessary for DVB-T here in NZ.
Cheers, Paul
On Feb 11, 2009, at 10:02 PM, Paul Kendall wrote:
On Sun, Feb 1, 2009 at 4:37 AM, Paul Kendall <paul at kcbbs.gen.nz> wrote:
Micheal, Sorry for the long delay in this! Been really busy with other things. Now there is a bit of noise on the MythTV lists about this so I thought it time that I get back to it.
On Thursday 18 September 2008 06:24:48 Michael Niedermayer wrote:
Hi
On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote: > On Thursday 03 July 2008 22:16:56 Paul Kendall wrote: >> Hi attached is a patch that provides a AAC LATM parser >> CODEC_ID_AAC_LATM I have been working on. The libfaad decoder >> is >> also patched to provide another codec the decoding for this >> codec id. There are minor patches to mpeg.c & mpegts.c to send >> stream id 0x11 to this codec id. >> >> With this patch I can get audio working perfectly for NZ DVB-T >> using the stock unpatched libfaad2 library. >> >> I would welcome comments and suggestions so this can be >> included >> in the ffmpeg codebase. >> >> Cheers, >> Paul Kendall > > Doh! > I missed a vital part of the patch! Putting the codec in the > allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ...
Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ...
The parser needs to be modified to handle the LATM wrapping and packetize the stream. Should the parser also set the extradata so the decoder can use that to set the channels, sample rate & sample size? or should this be left to the bitstream filter?
The bitstream filter should just check the LATM wrapping and remove if present.
The decoder then gets raw AAC data and all the parameters have been set by the parser and so it should all work fine.
Is that the plan?
Hi Paul, Is there any update on this? the approach sounds about right I was waiting to hear back from one of the devs as whether this is
On Thursday 12 February 2009 00:53:21 Jai Menon wrote: the right approach. I am keen to get this sorted ASAP as it is necessary for DVB-T here in NZ.
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though. -DrD-
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that. Cheers, Paul
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with. -DrD-
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
-DrD-
-- Regards, Jai
On Feb 13, 2009, at 12:32 AM, Jai Menon wrote:
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
Is there a folder for these already? Otherwise I'll just make a new one and post the path. -DrD-
On Fri, Feb 13, 2009 at 08:12:40AM -0800, David DeHaven wrote:
On Feb 13, 2009, at 12:32 AM, Jai Menon wrote:
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
Is there a folder for these already? Otherwise I'll just make a new one and post the path.
Just put it in a new folder in incoming. Diego
On Feb 13, 2009, at 8:12 AM, David DeHaven wrote:
On Feb 13, 2009, at 12:32 AM, Jai Menon wrote:
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
Is there a folder for these already? Otherwise I'll just make a new one and post the path.
Nevermind, can't write outside of incoming anyways :) It's going up to ftp://samples.mplayerhq.hu/MPlayer/incoming/dvb_norway_aac_latm/DVB-T_Norway_AAC_LATM_Sample.ts Sample is 25 megs, ETA about 4:45 PM UTC. With the LATM patch from Handbrake, it can play the audio track but it reports a negative bitrate: Input #0, mpegts, from 'DVB-T_Norway_NRK3_through_DVBViewer.ts': Duration: 00:01:01.66, start: 94037.583800, bitrate: 3303 kb/s Program 117 Program 118 Program 119 Program 102 Program 103 Stream #0.0[0x209]: Video: h264, yuv420p, 720x576, AR: 20:11, progressive, 25.00 fps(r) Stream #0.1[0x2a4](nor): Audio: AAC_LATM, 48000 Hz, stereo, s16, -3192 kb/s Stream #0.2[0x25c](nor): Subtitle: dvbsub Stream #0.3[0x25d](nor): Subtitle: dvbsub Program 104 Program 105 Program 106 Program 107 Program 108 Program 109 Program 110 Program 111 Program 112 Program 113 Program 114 Program 115 Program 116 Program 122 Program 1001 Program 1002 Program 1102 At least one output file must be specified So, what does that mean? Does it move so fast across the wire it creates a vacuum and pulls other bits along? ;) -DrD-
On Feb 13, 2009, at 8:29 AM, David DeHaven wrote:
On Feb 13, 2009, at 8:12 AM, David DeHaven wrote:
On Feb 13, 2009, at 12:32 AM, Jai Menon wrote:
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote:
Well, a slightly different (?) version works for streams from Norway too. I tried this one from the Handbrake project: http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch
That's basically my first attempt at a patch to get it working quick & dirty in MythTV
One issue I'm seeing is it's reporting a negative bitrate. I don't have much material to test with though.
I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
Is there a folder for these already? Otherwise I'll just make a new one and post the path.
Nevermind, can't write outside of incoming anyways :)
It's going up to ftp://samples.mplayerhq.hu/MPlayer/incoming/dvb_norway_aac_latm/DVB-T_Norway_AAC_LATM_Sample.ts
And a second sample going up named DVB-T_Norway_AAC_LATM_Sample2.mpg that had been remuxed into MPEG-2 PS. This one's 30 megs, ETA 5:20ish UTC. It shows the same negative bitrate, but it's from the same source. Duration: 00:00:57.38, start: 0.644278, bitrate: 4238 kb/s Stream #0.0[0x1e0]: Video: h264, yuv420p, 720x576, AR: 20:11, progressive, 25.00 fps(r) Stream #0.1[0x1c1]: Audio: AAC_LATM, 48000 Hz, stereo, s16, -3192 kb/s -DrD-
On Feb 13, 2009, at 8:56 AM, David DeHaven wrote:
On Feb 13, 2009, at 8:29 AM, David DeHaven wrote:
On Feb 13, 2009, at 8:12 AM, David DeHaven wrote:
On Feb 13, 2009, at 12:32 AM, Jai Menon wrote:
On Fri, Feb 13, 2009 at 8:40 AM, David DeHaven <dave at sagetv.com> wrote:
On Feb 12, 2009, at 6:46 PM, Paul Kendall wrote:
On Friday 13 February 2009 06:11:58 David DeHaven wrote: > Well, a slightly different (?) version works for streams from > Norway > too. I tried this one from the Handbrake project: > http://trac.handbrake.fr/browser/tags/0.9.3/contrib/patch-ffmpeg-latm.patch > That's basically my first attempt at a patch to get it working quick & dirty in MythTV
> One issue I'm seeing is it's reporting a negative bitrate. I > don't > have much material to test with though. > I'll have to check that.
I'll see if I can dig up a stream to test with.
Could you also upload a sample? a bigger one (compared to what we already have) would be great. Thanks.
Is there a folder for these already? Otherwise I'll just make a new one and post the path.
Nevermind, can't write outside of incoming anyways :)
It's going up to ftp://samples.mplayerhq.hu/MPlayer/incoming/dvb_norway_aac_latm/DVB-T_Norway_AAC_LATM_Sample.ts
And a second sample going up named DVB-T_Norway_AAC_LATM_Sample2.mpg that had been remuxed into MPEG-2 PS. This one's 30 megs, ETA 5:20ish UTC.
It shows the same negative bitrate, but it's from the same source.
Duration: 00:00:57.38, start: 0.644278, bitrate: 4238 kb/s Stream #0.0[0x1e0]: Video: h264, yuv420p, 720x576, AR: 20:11, progressive, 25.00 fps(r) Stream #0.1[0x1c1]: Audio: AAC_LATM, 48000 Hz, stereo, s16, -3192 kb/s
Does a roundup issue exist for this? A search for "latm" returned issue 244 by Aurel. It seems related but I also have an MPEG-PS sample, and it doesn't address the second issue of the negative bitrate being reported. And were the samples moved or removed? I logged in to upload text files to describe the issue and couldn't change to the directory... (my fault, I should have done that last week) -DrD-
On Thu, Feb 12, 2009 at 07:02:56PM +1300, Paul Kendall wrote:
On Thursday 12 February 2009 00:53:21 Jai Menon wrote:
On Sun, Feb 1, 2009 at 4:37 AM, Paul Kendall <paul at kcbbs.gen.nz> wrote:
Micheal, Sorry for the long delay in this! Been really busy with other things. Now there is a bit of noise on the MythTV lists about this so I thought it time that I get back to it.
On Thursday 18 September 2008 06:24:48 Michael Niedermayer wrote:
Hi
On Wed, Sep 17, 2008 at 04:57:46PM +1200, Paul Kendall wrote:
On Wednesday 17 September 2008 12:51:18 Michael Niedermayer wrote:
On Fri, Jul 04, 2008 at 09:28:37AM +1200, Paul Kendall wrote: > On Thursday 03 July 2008 22:16:56 Paul Kendall wrote: > > Hi attached is a patch that provides a AAC LATM parser > > CODEC_ID_AAC_LATM I have been working on. The libfaad decoder is > > also patched to provide another codec the decoding for this > > codec id. There are minor patches to mpeg.c & mpegts.c to send > > stream id 0x11 to this codec id. > > > > With this patch I can get audio working perfectly for NZ DVB-T > > using the stock unpatched libfaad2 library. > > > > I would welcome comments and suggestions so this can be included > > in the ffmpeg codebase. > > > > Cheers, > > Paul Kendall > > Doh! > I missed a vital part of the patch! Putting the codec in the > allcodecs.c file! Heres a modified patch.
I think a parser is not the correct place to remove the LATM stuff. A parser should only split things into frames and extract information, not remove information. This for example is important if one wants to preserve the LATM and mux it into another container. LATM could be removed in a bitstream filter ....
Ok, I can look into this. Is there any docs on this.
well ... the source code :) but you can ask questions here if you have any, also keep in mind if the bitstream filter API has any problems it could be changed ...
Also note that a LATM parser or some changes to the AAC parser might still be required even with a bitstream filter, otherwise the AAC parser will likely be confused by the LATM stuff ...
The parser needs to be modified to handle the LATM wrapping and packetize the stream. Should the parser also set the extradata so the decoder can use that to set the channels, sample rate & sample size? or should this be left to the bitstream filter?
The bitstream filter should just check the LATM wrapping and remove if present.
The decoder then gets raw AAC data and all the parameters have been set by the parser and so it should all work fine.
Is that the plan?
Hi Paul, Is there any update on this? the approach sounds about right I was waiting to hear back from one of the devs as whether this is the right approach. I am keen to get this sorted ASAP as it is necessary for DVB-T here in NZ.
the approach does sound ok, and extradata should be extracted via split() and that may or may not need split() to be extended a little as its rather primitive and simplistic now. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
participants (6)
-
dave@sagetv.com -
diego@biurrun.de -
jmenon86@gmail.com -
michaelni@gmx.at -
paul@kcbbs.gen.nz -
robert.swain@gmail.com