[Freeswitch-users] Playback of AMR-WB files.
ha.ppy.neko
ha.ppy.neko at gmail.com
Wed Aug 23 22:06:24 UTC 2017
Indeed. If mod_amrwb is compiled in paththrough mode it sets
encoded_bytes_per_packet to 0 and mod_native_file skips this codec.
But if mod_amrwb is compiled with transcoding support it sets
encoded_bytes_per_packet to SWITCH_AMRWB_OUT_MAX_SIZE constant (61) and
mod_native_file registers AMR-WB extension. That was the case for my
installation.
So my theory was that native playback fails because of incorrect packet
size.
According to module source AMR-WB has 9 bitrate modes with corresponding
voice frame sizes (in bytes):
0 - 17
1 - 23
2 - 32
3 - 36
4 - 40
5 - 46
6 - 50
7 - 58
8 - 60
I recorded test RAW file with FS and record application at max bitrate and
resulting file was indeed stream of 62 bytes RTP payloads. 2 bytes AMR-WB
header + 60 bytes of voice data.
I recompiled mod_amrwb with encoded_bytes_per_packet set to 62 and was able
to successfully play RAW file!
There was warning "switch_core_file.c:358 File /tmp/recording.AMR-WB sample
rate 8000 doesn't match requested rate 16000" but it sounded fine
nevertheless.
I think this will work with passthrough mode too (change
encoded_bytes_per_packet param from 0 to 62), but I don't have time to test
it yet.
Of course I don't know if this change will not break other FS functions,
any ideas?
And second problem is that caller may request lower bitrate with frame size
40 for example and RAW file will be sliced incorrectly.
Thats the real deal breaker. Any tips how to make native playback honor
negotiated codec and set proper encoded_bytes_per_packet value?
2017-08-23 15:57 GMT+03:00 Michael Jerris <mike at jerris.com>:
> That was actually fixed recently. In current master code it won’t
> register them.
>
> On Aug 22, 2017, at 6:50 PM, ha.ppy.neko <ha.ppy.neko at gmail.com> wrote:
>
> I am not sure, but it looks like for given mode AMR and AMR-WB files have
> fixed frame size.
> "The length of the speech frame is implicitly defined by the mode
> indicated in the FT field":
>
> https://tools.ietf.org/html/rfc4867#page-35
>
> Anyway, it is strange that mod_native_file registers AMR and AMR-WB
> formats if it could not support them.
>
> 2017-08-23 0:21 GMT+03:00 Anthony Minessale <anthony.minessale at gmail.com>:
>
>> The question was answered by the log line you supplied.
>>
>> -- "cannot play or record native files with variable length data".
>>
>> VBR codecs are not a predictable size so you cannot make a raw file of it
>> because you don't have any idea how big each packet is.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170824/da0933f0/attachment.html>
More information about the FreeSWITCH-users
mailing list