[FFmpeg-devel] Add support for 24 bit RTSP audio playback

Submitted by Timur Aydin on Nov. 4, 2016, 10:15 p.m.

Details

Message ID 9055a438-bc13-54e2-b1e5-494f6705ec70@taydin.org
State New
Headers show

Commit Message

Timur Aydin Nov. 4, 2016, 10:15 p.m.
Hello guys,

When ffplay is used to play from the RTSP URL that serves 24 bit audio 
content, ffplay fails to recognize the audio codec format. The attached 
patch adds support for playing 24 bit audio content over RTSP by 
defining a dynamic payload handler for "L24".

Comments

Michael Niedermayer Nov. 5, 2016, 8:49 a.m.
On Sat, Nov 05, 2016 at 01:15:44AM +0300, Timur Aydin wrote:
> Hello guys,
> 
> When ffplay is used to play from the RTSP URL that serves 24 bit
> audio content, ffplay fails to recognize the audio codec format. The
> attached patch adds support for playing 24 bit audio content over
> RTSP by defining a dynamic payload handler for "L24".

do you have a testcase for this ?
    
[...]
compn Nov. 5, 2016, 1:21 p.m.
On Sat, 5 Nov 2016 01:15:44 +0300
Timur Aydin <ta@taydin.org> wrote:

> ff_register_rtp_dynamic_payload_handlers(void)
> ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
> ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler);
> ff_register_dynamic_payload_handler(&ff_vp9_dynamic_handler);
> +    ff_register_dynamic_payload_handler(&l24_dynamic_handler);
>      ff_register_dynamic_payload_handler(&gsm_dynamic_handler);
>      ff_register_dynamic_payload_handler(&opus_dynamic_handler);
>      ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler);

should probably l24 be under gsm as this list looks like alphabetical
order.

i've only seen l16 rtsp samples, have not seen l24 yet.

-compn
Timur Aydin Nov. 5, 2016, 4:03 p.m.
Here is a simple test case:

1) Use the live555 RTSP server to serve a 24 bit wav file.

2) Play this file using ffplay as follows:

   $ ffplay rtsp://<ip address>/audio.wav

In this case, ffplay fails as follows:

[ta@bonsai ~]$ ffplay rtsp://10.2.1.21:8554/wave
ffplay version 3.2 Copyright (c) 2003-2016 the FFmpeg developers
   built with gcc 6.2.1 (GCC) 20160830
   configuration: --prefix=/usr --disable-debug --disable-static 
--disable-stripping --enable-avisynth --enable-avresample 
--enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl 
--enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype 
--enable-libfribidi --enable-libgsm --enable-libiec61883 
--enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb 
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus 
--enable-libpulse --enable-libschroedinger --enable-libsoxr 
--enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp 
--enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf 
--enable-shared --enable-version3 --enable-x11grab
   libavutil      55. 34.100 / 55. 34.100
   libavcodec     57. 64.100 / 57. 64.100
   libavformat    57. 56.100 / 57. 56.100
   libavdevice    57.  1.100 / 57.  1.100
   libavfilter     6. 65.100 /  6. 65.100
   libavresample   3.  1.  0 /  3.  1.  0
   libswscale      4.  2.100 /  4.  2.100
   libswresample   2.  3.100 /  2.  3.100
   libpostproc    54.  1.100 / 54.  1.100
[rtsp @ 0x7fddbc000920] Could not find codec parameters for stream 0 
(Audio: none, 96000 Hz, 2 channels): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' 
options
Input #0, rtsp, from 'rtsp://10.2.1.21:8554/wave':
   Metadata:
     title           : wave
     comment         : wave
   Duration: 00:10:00.00, start: 0.001250, bitrate: N/A
     Stream #0:0: Audio: none, 96000 Hz, 2 channels
No codec could be found with id 0
Failed to open file 'rtsp://10.2.1.21:8554/wave' or configure filtergraph
Michael Niedermayer Nov. 5, 2016, 5:05 p.m.
On Sat, Nov 05, 2016 at 09:21:46AM -0400, compn wrote:
> On Sat, 5 Nov 2016 01:15:44 +0300
> Timur Aydin <ta@taydin.org> wrote:
> 
> > ff_register_rtp_dynamic_payload_handlers(void)
> > ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
> > ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler);
> > ff_register_dynamic_payload_handler(&ff_vp9_dynamic_handler);
> > +    ff_register_dynamic_payload_handler(&l24_dynamic_handler);
> >      ff_register_dynamic_payload_handler(&gsm_dynamic_handler);
> >      ff_register_dynamic_payload_handler(&opus_dynamic_handler);
> >      ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler);
> 
> should probably l24 be under gsm as this list looks like alphabetical
> order.

changed
applied

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 51feeea..c208c07 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -33,6 +33,12 @@ 
 
 #define MIN_FEEDBACK_INTERVAL 200000 /* 200 ms in us */
 
+static RTPDynamicProtocolHandler l24_dynamic_handler = {
+    .enc_name   = "L24",
+    .codec_type = AVMEDIA_TYPE_AUDIO,
+    .codec_id   = AV_CODEC_ID_PCM_S24BE,
+};
+
 static RTPDynamicProtocolHandler gsm_dynamic_handler = {
     .enc_name   = "GSM",
     .codec_type = AVMEDIA_TYPE_AUDIO,
@@ -114,6 +120,7 @@  void ff_register_rtp_dynamic_payload_handlers(void)
     ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_vp9_dynamic_handler);
+    ff_register_dynamic_payload_handler(&l24_dynamic_handler);
     ff_register_dynamic_payload_handler(&gsm_dynamic_handler);
     ff_register_dynamic_payload_handler(&opus_dynamic_handler);
     ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler);