play media command failing (mr 12.5.1)

80 views
Skip to first unread message

Pete Kelly

unread,
Feb 10, 2025, 8:10:41 AM2/10/25
to Sipwise rtpengine
Hi

I am attempting to play a file into a call which is being recorded. The call is AMR-WB and the file is a wav, however this error presents in the logs:

rtpengine[2192078]: INFO: [19f.51567b07]: [control] Received command 'play media' from 10.215.18.6:46658
rtpengine[2192078]: ERR: [19f.51567b07]: [ffmpeg] av_log: Value -1.000000 for parameter 'osr' out of range [0 - 2.14748e+09]
rtpengine[2192078]: ERR: [19f.51567b07]: [ffmpeg] av_log: Failed to set option
rtpengine[2192078]: ERR: [19f.51567b07]: [core] Error resampling: failed to alloc resample context
rtpengine[2192078]: ERR: [19f.51567b07]: [core] Resampling failed


Any ideas of what I could check to look into this? The recording is working fine so I am assuming rtpengine has no issues encoding/decoding the stream

Pete Kelly

unread,
Feb 10, 2025, 8:56:47 AM2/10/25
to Sipwise rtpengine
Would this bear some relation to https://github.com/sipwise/rtpengine/issues/1841

?

Pete Kelly

unread,
Feb 10, 2025, 10:21:59 AM2/10/25
to Sipwise rtpengine
I've tried 13.1.1 and the change relating to 1841 but it has no effect. It seems like it's something simple but not sure where to look!

Richard Fuchs

unread,
Feb 10, 2025, 10:34:10 AM2/10/25
to rtpe...@googlegroups.com
"osr" is the output sampling rate, and this is coming from ffmpeg. Is media playback a general problem for you, or just towards AMR-WB? What did the SDP exchange from that client look like? What format (sampling rate, channels) does the input file have?

Cheeres
--
You received this message because you are subscribed to the Google Groups "Sipwise rtpengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtpengine+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rtpengine/d53207d0-7e08-4638-955a-277002fd9b05n%40googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Pete Kelly

unread,
Feb 10, 2025, 3:12:02 PM2/10/25
to rtpe...@googlegroups.com
Hi

PCMU/PCMA works fine with the file (for the same call scenario).

The file is a regular wav, 16bit 44100 Hz

Pete

Pete Kelly

unread,
Feb 10, 2025, 3:13:33 PM2/10/25
to rtpe...@googlegroups.com
Oops, forgot to mention the call is negotiated as 

a=rtpmap:104 AMR-WB/16000 a=fmtp:104 mode-change-capability=2;max-red=220

Pete

Pete Kelly

unread,
Feb 11, 2025, 7:07:14 AM2/11/25
to Sipwise rtpengine
Hi Richard

No problems normally with injecting media, It works fine with PCMU/PCMA, this is the file spec:

RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz

SDP looks like this:

offer:
m=audio 10134 RTP/AVP 104 110 102 108 8 0 105 100 b=AS:80 b=RS:625 b=RR:1875 a=ptime:20 a=maxptime:240 a=sendrecv a=rtpmap:104 AMR-WB/16000 a=fmtp:104 mode-change-capability=2;max-red=220 a=rtpmap:110 AMR-WB/16000 a=fmtp:110 octet-align=1;mode-change-capability=2;max-red=220 a=rtpmap:102 AMR/8000 a=fmtp:102 mode-change-capability=2;max-red=220 a=rtpmap:108 AMR/8000 a=fmtp:108 octet-align=1;mode-change-capability=2;max-red=220 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:105 telephone-event/16000 a=fmtp:105 0-15 a=rtpmap:100 telephone-event/8000 a=fmtp:100 0-15

answer:
m=audio 10352 RTP/AVP 104 105 c=IN IP4 x.x.x.x b=AS:29 b=RR:1087 b=RS:362 a=maxptime:240 a=rtpmap:104 AMR-WB/16000 a=fmtp:104 mode-change-capability=2;max-red=220 a=rtpmap:105 telephone-event/16000 a=fmtp:105 0-15 a=sendrecv a=ptime:20

Richard Fuchs

unread,
Feb 11, 2025, 7:48:12 AM2/11/25
to rtpe...@googlegroups.com
I can't really reproduce this using a similar call setup. It could be related to ffmpeg. Which platform (distro/version) is this on, and what version are your ffmpeg library packages?

If you're willing to experiment, you can add a logging line to lib/resample.c which prints the value of `to_format->clockrate` and see what it contains.

Cheers
Message has been deleted

Pete Kelly

unread,
Feb 11, 2025, 8:11:01 AM2/11/25
to Sipwise rtpengine
Hi

I’ve just tried testing the injection with a few other wav/mp3 files saved in different formats and it gives the same error each time so it seems to be AMR-WB related

ERR: [dd2.74a46804]: [ffmpeg] av_log: Value -1.000000 for parameter 'osr' out of range [0 - 2.14748e+09]
ERR: [dd2.74a46804]: [ffmpeg] av_log: Failed to set option
ERR: [dd2.74a46804]: [core] Error resampling: failed to alloc resample context                                                                                                   ERR: [dd2.74a46804]: [core] Resampling failed

Pete Kelly

unread,
Feb 11, 2025, 8:11:07 AM2/11/25
to rtpe...@googlegroups.com
Absolutely willing to experiment 🙂

I’ll try the lib/resample.c mod

This is Ubuntu 24.04 with the following ffmpeg

ffmpeg -version
ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100

Pete Kelly

unread,
Feb 11, 2025, 8:11:12 AM2/11/25
to rtpe...@googlegroups.com
-               if (!resample->swresample)
+               if (!resample->swresample) {
+                       ilog(LOG_ERR | LOG_FLAG_LIMIT, "PKDEBUG CLOCKRATE: %d", to_format->clockrate);
                        goto err;
+               }


This is the result:

[core] PKDEBUG CLOCKRATE: -1

Richard Fuchs

unread,
Feb 11, 2025, 9:46:24 AM2/11/25
to rtpe...@googlegroups.com
Check the output of `rtpengine --codecs`

I suspect you will see

              AMR-WB: supported for decoding only

Pete Kelly

unread,
Feb 11, 2025, 11:12:38 AM2/11/25
to rtpe...@googlegroups.com
You are correct sir 🙂 (whoops)

I assume this is something I can rectify by recompiling ffmpeg with the encoder?

You received this message because you are subscribed to a topic in the Google Groups "Sipwise rtpengine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rtpengine/X-feXwQyKOM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rtpengine+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rtpengine/151a032f-d81f-4b34-bb35-2da75f514da9%40sipwise.com.

Richard Fuchs

unread,
Feb 11, 2025, 11:19:14 AM2/11/25
to rtpe...@googlegroups.com
It's much simpler in fact. You can just install the package `libavcodec-extra` and that will give you full support.

There's also a booboo in the code that prevents it from producing an appropriate log message, saying that no supported codec is present. Fixes for this are coming soon, but this is mostly a cosmetic issue.

Cheers

Pete Kelly

unread,
Feb 11, 2025, 11:22:36 AM2/11/25
to rtpe...@googlegroups.com
Thanks for that! I feel very silly now and am off to hide under a rock 😕 

Pete

Reply all
Reply to author
Forward
0 new messages