[FFmpeg-user] Symmetric RTP / socket reuse flag

Renaud Schoonbroodt renaud.schoonbroodt at gmail.com
Sun Sep 9 19:29:12 EEST 2018

Hi everyone,

I am implementing a SIP user agent (softphone) in C++ where the media
encoding and decoding is handled by ffmpeg.  I basically have one PCMU
encoder and one PCMU decoder. Taken separately they both works fine.

To cope with NAT traversal issues, I need to do Symmetric RTP

Basically it means that my encoder and decoder need to use the same port.
But when I enable both encoder and decoder one fails I guess because the
port can't be reused.  Again, enabled separately it works like a charm.

I see the existence of the "reuse_socket" AVOption for UDP socket. But I
have very little experience with the ffmpeg API and don't know how to
access UDPContext form an AVFormatContext or AVCodecContext.

I have also seen the "reuse" flag for URL but it doesn't seem to work with

Does someone already succeed in doing this ?  Am I looking in the right
direction ?


Best regards,


More information about the ffmpeg-user mailing list