Opened 7 years ago

Closed 6 years ago

#6678 closed enhancement (fixed)

Read raw amr streams

Reported by: Simon Blandford 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 Carl Eugen Hoyos)

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 Carl Eugen Hoyos 7 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Simon Blandford, 7 years ago

Version: unspecifiedgit-master

by Carl Eugen Hoyos, 7 years ago

Attachment: patchamr.diff added

in reply to:  description comment:2 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavformat
Description: modified (diff)
Keywords: amr added
Priority: normalwish
Summary: AMR multicast receive: "Operation not permitted"Read raw amr streams
Type: defectenhancement

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 by Simon Blandford, 7 years ago

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

comment:4 by Carl Eugen Hoyos, 6 years ago

Resolution: fixed
Status: newclosed

Finally applied as e06bdc3c37f4fc756247bc5ebe576f2624b05e24, the demuxers also support auto-detection, it should not be necessary to force the amr input format.

Note: See TracTickets for help on using tickets.