Regarding to the issue while playing Mp3 file

Hi Team , I have a mp3 file and when i am trying to play that on asterisk
when i tried to play it give me the error

[Dec  2 12:28:40] WARNING[7477]: mp3/layer3.c:966 III_dequantize_sample: mpg123: Can't rewind stream by 4 bits!
    -- Channel Announcer/ARI-000003aa;2 left 'simple_bridge' stasis-bridge <8010de2c-a949-4aca-9ef3-8dc6e5e70f10>

can you please help me with this the same file which i tried to play on media player it is playing there can you please tell me what is the issue and i am using format_mp3 module in asterisk and version Asterisk certified/18.9-cert4

image

can you please tell me how to fix it in asterisk
and if i use sox command it will consumer more ram assuming that i will hit 10k per seconds then it will be problem as it will be done by shell_exec if there is any library that can convert this without using shell_exec let me know
Thanks

The “Can’t rewind stream by 4 bits” error usually pops up when Asterisk struggles with the MP3 file’s structure. Even though it plays fine on a media player, Asterisk is a bit pickier.

Try using sox to re-encode files into a format Asterisk is happier with.

sox yourfile.mp3 -r 8000 -c 1 -e signed-integer fixedfile.mp3

This makes sure the file is in mono and 8 kHz, which Asterisk generally prefers.

… Since you’re already using the format_mp3 module, make sure it’s loaded correctly. Restarting Asterisk after loading it doesn’t hurt:

module reload format_mp3.so

I get your concern about using sox with shell_exec for a high volume of files (10k/sec is no joke). One alternative could be using something like FFmpeg in your backend through a library (there are FFmpeg bindings for most languages). It’s more efficient than shelling out to commands, especially under heavy load.For example, with FFmpeg:

ffmpeg -i yourfile.mp3 -ar 8000 -ac 1 output.mp3

You could integrate this into your code instead of calling the shell.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.