[FFmpeg-user] importing rtp packet stream and decoding

Dave Horton daveh at beachdognet.com
Tue Sep 19 01:32:56 EEST 2017


On Sep 15, 2017, at 2:08 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:

2017-09-15 19:49 GMT+02:00 Dave Horton <daveh at beachdognet.com>:
> On Fri, Sep 15, 2017 at 1:41 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> wrote:
> 
>> 2017-09-15 19:36 GMT+02:00 Dave Horton <daveh at beachdognet.com>:
>>> Does anyone have a good recipe or example on how to import an rtp stream
>> and decode it with ffmpeg.  I have both the rtp file and the associate SDP
>> description of the payloads, but haven’t been able to pipe it into ffmpeg
>> to have it decoded.
>> 
>> Both sending and receiving opus via rtp is implemented in FFmpeg,
>> what did you try?

> I tried
> 
> ffmpeg -loglevel debug -f rtp -c:a opus -i call2.rtpdump -ar 48000
> call2.mp3
> 
> does that look right?

I tested the following in one terminal (assuming long input):
$ ffmpeg -i input -acodec opus -strict -2 -f rtp rtp://127.0.0.1/1234 >out.sdp

and in a second terminal:
$ ffplay -protocol_whitelist rtp,file,udp -i out.sdp

> I get 'Unsupported RTP version packet received' and a whole bunch of
> 'Received too short packet' so perhaps my data is bad.

Maybe, but I suspect you have to pass the sdp info.

> But I am wondering where/how to give ffmpeg the sdp information so it will
> now how to decode the payload types etc

Put it into a file and pass that to FFmpeg (should get auto-detected).

Carl Eugen
_______________________________________________


I’m sorry to be stumbling through this, but here is my first attempt:  
note that I have one file with my sdp description in it, and a second file that has the rtp stream I captured

Clearly, my sdp file was not recognized:

MacBook-Pro-6:test dhorton$ ffmpeg -loglevel debug -i rtp1.sdp -f rtp -i rtp1.rtp -f mp3 rtp1.mp3
ffmpeg version N-87034-geca2a49 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.29)
  configuration: --disable-optimizations --disable-stripping --enable-debug --extra-cflags='-g -O0' --enable-libmp3lame
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.103.100 / 57.103.100
  libavformat    57. 76.100 / 57. 76.100
  libavdevice    57.  7.101 / 57.  7.101
  libavfilter     6.100.100 /  6.100.100
  libswscale      4.  7.102 /  4.  7.102
  libswresample   2.  8.100 /  2.  8.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'rtp1.sdp'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Reading option '-i' ... matched as input url with argument 'rtp1.rtp'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp3'.
Reading option 'rtp1.mp3' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtp1.sdp.
Successfully parsed a group of options.
Opening an input file: rtp1.sdp.
[NULL @ 0x7fab14001000] Opening 'rtp1.sdp' for reading
[file @ 0x7fab13700e40] Setting default whitelist 'file,crypto'
[sdp @ 0x7fab14001000] Format sdp probed with size=2048 and score=50
[sdp @ 0x7fab14001000] Before avformat_find_stream_info() pos: 279 bytes read:279 seeks:0 nb_streams:0
[sdp @ 0x7fab14001000] All info found
[sdp @ 0x7fab14001000] After avformat_find_stream_info() pos: 279 bytes read:279 seeks:0 frames:0
Input #0, sdp, from 'rtp1.sdp':
  Metadata:
    title           : session
  Duration: N/A, bitrate: N/A
Successfully opened the file.
Parsing a group of options: input url rtp1.rtp.
Applying option f (force format) with argument rtp.
Successfully parsed a group of options.
Opening an input file: rtp1.rtp.
[file @ 0x7fab13701c60] Setting default whitelist 'file,crypto'
[rtp @ 0x7fab14009600] Guessing on RTP content - if not received properly you need an SDP file describing it
[rtp @ 0x7fab14009600] SDP:
v=0
c=IN IP6 
m=audio -1 RTP/AVP 0

[rtp @ 0x7fab14009600] getaddrinfo(): nodename nor servname provided, or not known
[rtp @ 0x7fab14009600] getnameinfo: ai_family not supported
rtp1.rtp: Input/output error
[AVIOContext @ 0x7fab13700f80] Statistics: 279 bytes read, 0 seeks

my sdp file contains this:

v=0
o=root 2116403914 2116403914 IN IP4 81.201.82.161
s=session
c=IN IP4 35.195.214.30
t=0 0\r\nm=audio 40558 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
a=rtcp:40559



More information about the ffmpeg-user mailing list