[Freeswitch-users] Playback of AMR-WB files.

Michael Jerris mike at jerris.com
Wed Aug 23 22:25:29 UTC 2017


Thats a bug.  AMR-WB is not fixed rate so it should be setting that value to 0.  That change will make mod_native_file not load it.  Toss me a pull request to fix and I’ll merge it.


> On Aug 23, 2017, at 6:06 PM, ha.ppy.neko <ha.ppy.neko at gmail.com> wrote:
> 
> 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 <mailto: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 <mailto: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 <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 <mailto: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/20170823/bc160e6f/attachment-0001.html>


More information about the FreeSWITCH-users mailing list