Posted: Fri Jul 11, 2008 7:56 pm Post subject: [Asterisk-video] can't hear amr audio
Hi,
Quote:
My camera (a Vivotek PZ7152) is set to AMR audio and when app_rtsp connects it correctly identifies an audio track containing amr audio AMR/8000, but I get no audio, only video. I would appreciate some help or suggestions to get audio working.
and I added the octet-aligned setting, which according to the sdp from the camera is the correct setting.
Quote:
[amr]octet-aligned=1 ------------------------ I’ve done some debugging in app_rtsp.c and found that: This comparision ‘if (sdp->audio->formats[i]->format & chan->nativeformats)’ in app_rtsp.c fails. [amr]
Posted: Mon Jul 14, 2008 7:56 am Post subject: [Asterisk-video] can't hear amr audio
Which codec is: fmt 00002000 ? I think this is 2>>13 = AMR.
Thus I am irritated by " 0x580004 (ulaw|h263|h263p) to 0x0 (nothing)"
The 0x0 should be 0x2000 (AMR) - try to find out why the AMR bitmask
flag is lost when calling set_format().
regards
klaus
Andrew Buchanan schrieb:
Quote:
Hi,
My camera (a Vivotek PZ7152) is set to AMR audio and when app_rtsp connects it correctly identifies an audio track containing amr audio AMR/8000, but I get no audio, only video. I would appreciate some help or suggestions to get audio working.
------------------------
I compiled asterisk using the instructions to enable amr audio
and I added the octet-aligned setting, which according to the sdp from
the camera is the correct setting.
[amr]
octet-aligned=1
------------------------
I’ve done some debugging in app_rtsp.c and found that:
This comparision ‘if (sdp->audio->formats[i]->format & chan->nativeformats)’ in app_rtsp.c fails.
the value of format is 0x00002000
the value of nativeformats is 0x00580004
I also get this warning
[Jul 11 16:36:45] WARNING[31498]: channel.c:2800 set_format: Unable to find a codec translation path from 0x580004 (ulaw|h263|h263p) to 0x0 (nothing)
I’m not sure why only ulaw,h263,h263p show up, but they are the only protocols I have enabled in xlite, so that could be it, but the 0x0 (nothing) I don’t know.
Some debug code (my app_rtsp line #’s might be off a bit as I added some debug statements)
Posted: Mon Jul 14, 2008 4:53 pm Post subject: [Asterisk-video] can't hear amr audio
Hi Klaus,
Thanks for your reply.
The line
"audioFormat = sdp->audio->formats[i]->format;" (app_rtsp.c)
is never processed because the comparision
"if (sdp->audio->formats[i]->format & chan->nativeformats)" (app_rtsp.c)
fails.
the value of format is 0x00002000
the value of nativeformats is 0x00580004
But the value written by
"ast_set_write_format(chan, audioFormat | videoFormat);"
Is nonzero as videoformat has a value 0x00400000
Send asterisk-video mailing list submissions to
asterisk-video@lists.digium.com
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.digium.com/mailman/listinfo/asterisk-video
or, via email, send a message with subject or body 'help' to
asterisk-video-request@lists.digium.com
You can reach the person managing the list at
asterisk-video-owner@lists.digium.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of asterisk-video digest..."
Message: 1
Date: Mon, 14 Jul 2008 10:46:32 +0200
From: Klaus Darilion <klaus.mailinglists@pernau.at>
Subject: Re: [Asterisk-video] can't hear amr audio
To: Development discussion of video media support in Asterisk
<asterisk-video@lists.digium.com>
Message-ID: <487B1268.80606@pernau.at>
Content-Type: text/plain; charset=windows-1252; format=flowed
Which codec is: fmt 00002000 ? I think this is 2>>13 = AMR.
Thus I am irritated by " 0x580004 (ulaw|h263|h263p) to 0x0 (nothing)"
The 0x0 should be 0x2000 (AMR) - try to find out why the AMR bitmask
flag is lost when calling set_format().
regards
klaus
Andrew Buchanan schrieb:
Quote:
Hi,
My camera (a Vivotek PZ7152) is set to AMR audio and when app_rtsp
connects it correctly identifies an audio track containing amr audio
AMR/8000, but I get no audio, only video. I would appreciate some help
or suggestions to get audio working.
Quote:
------------------------
I compiled asterisk using the instructions to enable amr audio
Posted: Mon Jul 14, 2008 5:30 pm Post subject: [Asterisk-video] can't hear amr audio
Andrew Buchanan wrote:
Quote:
Hi Klaus,
Thanks for your reply.
The line
"audioFormat = sdp->audio->formats[i]->format;" (app_rtsp.c)
is never processed because the comparision
"if (sdp->audio->formats[i]->format & chan->nativeformats)" (app_rtsp.c)
fails.
MAybe the bug is in this line. Actually it should work even if the sdp
does not contain a native format as Asterisk can do transcoding - I
think to do this the channels format has to be set to AMR (maybe with
ast_set_write_format()?)
Can you try changing the code?
regards
klaus
Quote:
the value of format is 0x00002000
the value of nativeformats is 0x00580004
But the value written by
"ast_set_write_format(chan, audioFormat | videoFormat);"
Is nonzero as videoformat has a value 0x00400000
Andrew Buchanan
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Thu Jul 17, 2008 7:24 pm Post subject: [Asterisk-video] can't hear amr audio
Hi Klaus and Andrew,
I've just taken a quick look at the code, but I think that the code was there to be able to choose between the different codecs offered (without transcoding)
Now that we have support for amr in asterisk perhaps could be changed for something like ast_get_best_ codec or ast_codec_choose.
BR
Sergio
Klaus Darilion escribió:
Quote:
Quote:
Andrew Buchanan wrote:
Quote:
Hi Klaus,
Thanks for your reply.
The line
"audioFormat = sdp->audio->formats[i]->format;" (app_rtsp.c)
is never processed because the comparision
"if (sdp->audio->formats[i]->format & chan->nativeformats)" (app_rtsp.c)
fails.
MAybe the bug is in this line. Actually it should work even if the sdp
does not contain a native format as Asterisk can do transcoding - I
think to do this the channels format has to be set to AMR (maybe with
ast_set_write_format()?)
Can you try changing the code?
regards
klaus
Quote:
the value of format is 0x00002000
the value of nativeformats is 0x00580004
But the value written by
"ast_set_write_format(chan, audioFormat | videoFormat);"
Is nonzero as videoformat has a value 0x00400000
Andrew Buchanan
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Send asterisk-video mailing list submissions to
asterisk-video@lists.digium.com
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.digium.com/mailman/listinfo/asterisk-video
or, via email, send a message with subject or body 'help' to
asterisk-video-request@lists.digium.com
You can reach the person managing the list at
asterisk-video-owner@lists.digium.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of asterisk-video digest..."
Message: 1
Date: Thu, 17 Jul 2008 22:20:37 +0200
From: Sergio Garcia Murillo <sergio.garcia@fontventa.com>
Subject: Re: [Asterisk-video] can't hear amr audio
To: Development discussion of video media support in Asterisk
<asterisk-video@lists.digium.com>
Message-ID: <487FA995.9020407@fontventa.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Klaus and Andrew,
I've just taken a quick look at the code, but I think that the code was
there to be able to choose between the different codecs offered (without
transcoding)
Now that we have support for amr in asterisk perhaps could be changed
for something like ast_get_best_ codec or ast_codec_choose.
BR
Sergio
Klaus Darilion escribi?:
Quote:
Andrew Buchanan wrote:
> Hi Klaus,
>
> Thanks for your reply.
>
> The line
> "audioFormat = sdp->audio->formats[i]->format;" (app_rtsp.c)
> is never processed because the comparision
> "if (sdp->audio->formats[i]->format & chan->nativeformats)"
(app_rtsp.c)
Quote:
> fails.
>
MAybe the bug is in this line. Actually it should work even if the sdp
Quote:
does not contain a native format as Asterisk can do transcoding - I
think to do this the channels format has to be set to AMR (maybe with
ast_set_write_format()?)
Can you try changing the code?
regards
klaus
> the value of format is 0x00002000
> the value of nativeformats is 0x00580004
> But the value written by
> "ast_set_write_format(chan, audioFormat | videoFormat);"
> Is nonzero as videoformat has a value 0x00400000
>
> Andrew Buchanan
>
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Message: 2
Date: Fri, 18 Jul 2008 00:30:41 +0200
From: Klaus Darilion <klaus.mailinglists@pernau.at>
Subject: Re: [Asterisk-video] recent app_h324m.c commit - AMR
frame
size patches
To: Development discussion of video media support in Asterisk
<asterisk-video@lists.digium.com>
Message-ID: <487FC811.2010203@pernau.at>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Sergio Garcia Murillo wrote:
Quote:
I agree, thank you very much Klaus. Patch commited.
Can you please test your scenario again if it still works?
thanks
klaus
Quote:
BR
Sergio
Klaus Darilion escribi?:
> Hi Sergio!
>
> I think if we define blocksize as in the previous mail, the code for
> if2->AMR conversion is wrong and should be:
>
> /*If amr+TOC needs a byte more than if2 */
> if(stuf < 4)
> {
> /* Set last byte */
> data[bs] = data[bs - 1] << 4;
> /*Increase size of frame*/
> send->datalen++;
>
> /* For each byte */
> for(j=bs-1; j>0; j--)
> data[j] = data[j] >> 4 | data[j-1] << 4;
> }
> else
> {
> /* For each byte */
> for(j=bs; j>0; j--)
> data[j] = data[j] >> 4 | data[j-1] << 4;
> }
>
>
> instead of
>
> /*If amr has a byte more than if2 */
> if(stuf < 4)
> {
> /* Set last byte */
> data[bs] = data[bs - 1] << 4;
> /*Increase size of frame*/
> send->datalen++;
> }
>
> /* For each byte */
> for(j=bs-1; j>0; j--)
> data[j] = data[j] >> 4 | data[j-1] << 4;
>
>
> regards
> klaus
>
> Klaus Darilion schrieb:
>
>> Again the same old story :-) Whe should have documented that. It is
up
Quote:
>> to use how we define the term "blocksize". It can be either the size
of
Quote:
>> the frame received from libh324m (in if2 format) or the size of the
AMR
Quote:
>> frame used in ast_frame (octed aligned RFC 3267 mode).
>>
>> I think the code now handles "blocksize" as the octed-aligned AMR
frame
Quote:
>> size. Currently the blocksize is mixed (before it was if2). What
about
Quote:
>> this wording:
>>
>>
>>
>>
>>
>> These are the different AMR modes (Table 1 from RFC 3267)
>>
>> Class A total speech
>> Index Mode bits bits
>> ----------------------------------------
>> 0 AMR 4.75 42 95
>> 1 AMR 5.15 49 103
>> 2 AMR 5.9 55 118
>> 3 AMR 6.7 58 134
>> 4 AMR 7.4 61 148
>> 5 AMR 7.95 75 159
>> 6 AMR 10.2 65 204
>> 7 AMR 12.2 81 244
>> 8 AMR SID 39 39
>>
>> Table 1. The number of class A bits for the AMR codec.
>>
>> Asterisk's internal AMR format:
>> ===============================
>>
>> Asterisk internally use the "octed-aligned" RTP format in ast_frame.
>> (see section 4.4 in RFC 3267)
>> This allows to have multiple AMR frames in one Asterisk frame. This
>> means, the payload of an ast_frame wich contains N AMR frames
consists
Quote:
>> of (se also section 4.4.5.1 of RFC 3267):
>>
>> 1. 1 byte CMR (codec mode request)
>> 2. N byte TOC (the TOC contains the AMR mode of the respecitve
frame
Quote:
>> and one bit which tells us if it is the last TOC or if there
are
Quote:
>> some more)
>> 3. blocksize(AMR frame 0) + ..... + blocksize(AMR frame N)
>>
>> We define the blocksize of an AMR frame os the number of bytes
needed
Quote:
>> to contain an AMR frame in the respective mode. Thus, it is the
number
Quote:
>> of total speech bits divided by 8 and rounded upwards.
>> E.g. an AMR frame in mode 5 has 159 bits. To store this frame we
need
Quote:
>> 20 bytes. Thus, the blocksize of an AMR frame in mode 5 is 20 bytes.
>>
>> H324M AMR format:
>> =================
>> In H324M, the AMR frames received from are in if2 format from
libh324m.
Quote:
>> (see Annex A in TS 26.101). This means that there are 4 bits for the
AMR
Quote:
>> mode followed by the speech bits. E.g. an AMR frame in mode 5 in if
format
Quote:
>> needs 159+4 => 21 bytes.
>> There is always only one AMR frame in an if2 packet.
>>
>> Extended Table 1:
>> ==================
>>
>> Class A total speech block if2 frame
>> Index Mode bits bits size size
>> -------------------------------------------------------------
>> 0 AMR 4.75 42 95 12 13
>> 1 AMR 5.15 49 103 13 14
>> 2 AMR 5.9 55 118 15 16
>> 3 AMR 6.7 58 134 17 18
>> 4 AMR 7.4 61 148 19 19
>> 5 AMR 7.95 75 159 20 21
>> 6 AMR 10.2 65 204 26 26
>> 7 AMR 12.2 81 244 31 31
>> 8 AMR SID 39 39 5 6
>>
>>
>>
>>
>>
>> regards
>> klaus
>>
>> Sergio Garcia Murillo schrieb:
>>
>>> Hi Klaus,
>>>
>>> I used an advanced method called try & error ;)
>>>
>>> The original values were taken from the mpeg4ip packetization code,
the
Quote:
>>> latest changes in the values from the low
>>> bit rates ones are due to an error reproducing a mp4 file created
with
Quote:
>>> ffmpeg at those bit rates and adjusted them til
>>> everything worked again.
>>>
>>> If everyone find any mode not working just let me know and I'll try
to
Quote:
>>> fix it. Or if anyone knows how to calculate the
>>> correct ones then please tell me.
>>>
>>> Best regards
>>> Sergio
>>>
>>> Klaus Darilion escribi?:
>>>
>>>> Hi Sergio!
>>>>
>>>> I wonder how you calculate the block size - I can not reproduce
it.
Quote:
>>>>
>>>> Is it just dividing the bits of table 1 in RFC 3267 by 8 and
rounding or
Quote:
>>>> is there some more magic?
>>>>
>>>> thanks
>>>> klaus
>>>>
>>>> _______________________________________________
>>>> --Bandwidth and Colocation Provided by
http://www.api-digital.com--
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum