Opened 4 weeks ago

Last modified 3 weeks ago

#6678 new enhancement

Read raw amr streams

Reported by: simonb Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: amr
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by cehoyos)

Summary of the bug: AMR over UDP works between 127.0.0.1 TX and 0.0.0.0 RX as expected but fails over a multicast address

How to reproduce:
1) Create a test transmitter:

% ffmpeg -re -f lavfi -i "sine=frequency=432:sample_rate=16000" -c:a libvo_amrwbenc -b:a 14250 -f amr udp://@239.200.10.0:1234

2) Create a test receiver probe:

% ffprobe -v 9 -loglevel 99 -f amr udp://@239.200.10.0:1234

Expected result:

...
Input #0, amr, from 'udp://0.0.0.0:1234':
  Duration: N/A, bitrate: 14 kb/s
    Stream #0:0, 50, 1/16000: Audio: amr_wb (sawb / 0x62776173), 16000 Hz, mono, flt

Actual result:

ffprobe version N-87327-g18821e3ba1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 75.100 / 55. 75.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.100 / 57. 82.100
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[amr @ 0x42411a0] Opening 'udp://239.200.10.0:1234' for reading
[udp @ 0x4241a40] No default whitelist set
[udp @ 0x4241a40] end receive buffer size reported is 131072
[AVIOContext @ 0x4261e40] Statistics: 37 bytes read, 0 seeks
udp://239.200.10.0:1234: Operation not permitted

For comparison, working example of non-multicast UDP
1) Create the test transmitter

% ffmpeg -re -f lavfi -i "sine=frequency=432:sample_rate=16000" -c:a libvo_amrwbenc -b:a 14250 -f amr udp://127.0.0.1:1234

2) Create a test receiver probe:

% ffprobe -v 9 -loglevel 99 -f amr udp://0.0.0.0:1234

Working example result:

ffprobe version N-87327-g18821e3ba1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 75.100 / 55. 75.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.100 / 57. 82.100
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[amr @ 0x4b041a0] Opening 'udp://0.0.0.0:1234' for reading
[udp @ 0x4b04a40] No default whitelist set
[udp @ 0x4b04a40] end receive buffer size reported is 131072
[amr @ 0x4b041a0] Before avformat_find_stream_info() pos: 9 bytes read:46 seeks:0 nb_streams:1
[amr @ 0x4b041a0] All info found
[amr @ 0x4b041a0] stream 0: start_time: -576460752303423.500 duration: -576460752303423.500
[amr @ 0x4b041a0] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=14 kb/s
[amr @ 0x4b041a0] After avformat_find_stream_info() pos: 1859 bytes read:1859 seeks:0 frames:50
Input #0, amr, from 'udp://0.0.0.0:1234':
  Duration: N/A, bitrate: 14 kb/s
    Stream #0:0, 50, 1/16000: Audio: amr_wb (sawb / 0x62776173), 16000 Hz, mono, flt
[AVIOContext @ 0x4b24e40] Statistics: 1859 bytes read, 0 seeks

Attachments (1)

patchamr.diff (2.7 KB) - added by cehoyos 4 weeks ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 4 weeks ago by simonb

  • Version changed from unspecified to git-master

Changed 4 weeks ago by cehoyos

comment:2 in reply to: ↑ description Changed 4 weeks ago by cehoyos

  • Component changed from undetermined to avformat
  • Description modified (diff)
  • Keywords amr added
  • Priority changed from normal to wish
  • Summary changed from AMR multicast receive: "Operation not permitted" to Read raw amr streams
  • Type changed from defect to enhancement

Replying to simonb:

For comparison, working example of non-multicast UDP

Hard to understand...

Please test attached patch with -f amrwb and report back.

comment:3 Changed 3 weeks ago by simonb

The patch seems to have fixed it. I can probe the stream now correctly plus ffmpeg processes the stream OK.

Many thanks

~/Documents/Source/ffmpeg/ffmpeg-static $ bin/ffprobe -v 9 -loglevel 99 -f amrwb udp://@239.200.10.0:1234
ffprobe version N-87397-g6bf48c4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/home/simonb/Documents/Source/ffmpeg/ffmpeg-static/target --pkg-config-flags=--static --extra-cflags=-I/home/simonb/Documents/Source/ffmpeg/ffmpeg-static/target/include --extra-ldflags=-L/home/simonb/Documents/Source/ffmpeg/ffmpeg-static/target/lib --extra-ldexeflags=-static --bindir=/home/simonb/Documents/Source/ffmpeg/ffmpeg-static/bin --enable-pic --enable-ffplay --enable-ffserver --enable-fontconfig --enable-frei0r --enable-gpl --enable-version3 --enable-libass --enable-libfribidi --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-nonfree --enable-openssl
  libavutil      55. 76.100 / 55. 76.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.101 / 57. 82.101
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.106.100 /  6.106.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[amrwb @ 0x34828c0] Opening 'udp://@239.200.10.0:1234' for reading
[udp @ 0x3483200] No default whitelist set
[udp @ 0x3483200] end receive buffer size reported is 131072
[amrwb @ 0x34828c0] Before avformat_find_stream_info() pos: 0 bytes read:37 seeks:0 nb_streams:1
[amrwb @ 0x34828c0] All info found
[amrwb @ 0x34828c0] stream 0: start_time: -576460752303423.500 duration: -576460752303423.500
[amrwb @ 0x34828c0] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=14 kb/s
[amrwb @ 0x34828c0] After avformat_find_stream_info() pos: 1850 bytes read:1850 seeks:0 frames:50
Input #0, amrwb, from 'udp://@239.200.10.0:1234':
  Duration: N/A, bitrate: 14 kb/s
    Stream #0:0, 50, 1/16000: Audio: amr_wb (sawb / 0x62776173), 16000 Hz, mono, flt
[AVIOContext @ 0x34a3660] Statistics: 1850 bytes read, 0 seeks
Note: See TracTickets for help on using tickets.