[Libav-user] RTP to RTSP remuxing

Emmanuel Riou emmanuel.riou at dazzl.tv
Thu Jan 19 12:43:32 EET 2017


Hello everyone,

I am using livav-ffmpeg (ubuntu 16-04 LTS liav-ffmpeg packages) to 
forward RTP streams from a webRTC gateway to a streaming server. I have 
to remux my incoming RTP streams (i.e my audio and my video stream) 
using a RTSP muxer in order to contact my streaming server:

- Incoming RTP audio packets are encoded in OPUS, I transcode them into 
AAC before sending them to the RTSP muxer, which works fine

- On the video side, I get h264 packets from the incoming RTP video 
stream, that I just want to re-inject into the output RTSP muxer. I am 
struggling to do this correctly.

On the video side, what I do basically is:

- I create an AVPacket from my incoming h264 payload I get from my 
incoming RTP video stream

- I setup my packet.stream_index to make it point to my RTSP video stream

- then I call av_write_frame(rtsp_format_context, &packet)


Only the audio is sent (and received correcly by my streaming server), 
on the video side, it enters rtp_write_packet function (I get "0: write 
len=..." messages), and then nothing, packet is never sent. Once 
rtp_write_packet is entered I don't understand why the packet is not 
sent?? What is weird is that if I don't create an audio stream (so my 
RTSP muxer contains only my video stream), my video is sent correctly. 
So the problem happens when I have 2 streams in my RTSP muxer. Do you 
have any explanation for this?

I know, anyway that what I am doing is not correct: As my RTSP video 
stream is initialized with a H264 codec id, rtp_write_packet is 
computing a new NAL for each new packet. But I already have a correct 
NAL in my incoming RTP payload that I would not like to strip out. 
Basically I would just like to forward my incoming RTP h264 payload with 
no modification into my RTSP muxer, is there a simple way to do this?

Thanks a lot,

Emmanuel.



More information about the Libav-user mailing list