Simon S
Simon S

Reputation: 1

No output when creating an RTMP stream from an RTP stream with FFmpeg

I am building a service that needs to convert RTP streams into HLS streams. The requirements recently shifted, and I now have to create an RTMP stream from the RTP stream and then convert the RTMP to HLS using two separate FFmpeg processes. The problem is that the RTP to RTMP process doesn't actually output anything to the specified RTMP URL.

Going directly from RTP to HLS with the following command (some options removed for brevity) works as expected:

ffmpeg -f sdp \
       -protocol_whitelist file,udp,rtp \
       -i example.sdp \
       -g 2 \
       -hls_time 2.0 \
       -hls_list_size 5 \
       -vcodec libx264 \
       -acodec aac \
       -f hls chunks/test-master.m3u8

However, converting RTP to RTMP with the following command yields no output, nor does it seem to be receiving any input despite the use of an identical SDP file:

ffmpeg -f sdp \
       -protocol_whitelist pipe,udp,rtp \
       -i example.sdp \
       -g 2 \
       -vcodec libx264 \
       -acodec aac \
       -f flv rtmp://localhost/test-stream

This is an example of what the SDP file looks like:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=Test
c=IN IP4 127.0.0.1
t=0 0
m=audio 37000 RTP/AVPF 97
a=rtpmap:97 opus/48000/2
a=fmtp:97 minptime=10;useinbandfec=1
m=video 37002 RTP/AVPF 96
a=rtpmap:96 H264/90000
a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001E

MediaSoup generates the RTP stream, and the ports and host match up. I've verified that there is actually a stream of data coming through the ports in question using nc. There are no error messages. Am I missing something obvious here?

Upvotes: 0

Views: 848

Answers (1)

Jed
Jed

Reputation: 89

MediaSoup is built with SFU (Selective Forwarding Unit). As I can see that you're using: m=video 37002 RTP/AVPF 96 a=rtpmap:96 H264/90000 a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001E. You need to make sure the consumer for video stream is using the same video codec, this can be done by console.log(consumer.rtpParameters.codecs);

Upvotes: 0

Related Questions