Convert RTP (OPUS) stream to HLS (AAC) stream using ffmpeg or gstreamer

Viewed 936

I currently have an RTP protocol stream in OPUS codec playing locally on rtp://127.0.0.1:5006

I would like to convert this stream into an HLS protocol with AAC codec (or others if easier) so that it is more accessible to devices with just a browser.

I know that ffmpeg and gstreamer are capable of this but I'm just lost among the various arguments/parameters.

Currently, I have an SDP file that describes my stream (unsure if this is correct, I wrote it after just googling/reading the spec)

v=0
t=0 0
m=audio 5006 RTP/AVP 98
c=IN IP4 127.0.0.1
a=recvonly
a=rtpmap:98 opus/48000/2
a=fmtp:98 stereo=0; sprop-stereo=0; useinbandfec=1c

Any ideas?

1 Answers

I was able to get this to work by using the below command. The SDP file seemed to work without issues as well.

ffmpeg -protocol_whitelist file,udp,rtp -i input.sdp -c:a aac -b:a 128k -ac 2 -f hls -hls_time 4 -hls_playlist_type event outputstream.m3u8

If anyone else had issues understanding the arguments like me, just take the time to search the arguments in https://ffmpeg.org/ffmpeg.html and understand them. Everything becomes much more straightforward then.

Related