OvenMediaEngine icon indicating copy to clipboard operation
OvenMediaEngine copied to clipboard

Support OPUS in SRT Provider

Open fcqpl opened this issue 3 years ago • 11 comments

Is your feature request related to a problem? Please describe. SRT not support OPUS codec. [2021-06-15 12:57:47.681] E [SPSRT:81] MPEGTS_DEPACKETIZER | mpegts_depacketizer.cpp:555 | Unsupported codec has been received. (pid : 257 stream_type : 6)

Describe the solution you'd like Add OPUS codec for incoming SRT stream. Then audio will be prepared to WebRTC in source, not transcoded with OvenMediaEngine. https://airensoft.gitbook.io/ovenmediaengine/live-source/srt-beta

fcqpl avatar Jun 17 '21 22:06 fcqpl

Do you know where is the documentation on how to packetize/depacketize OPUS in MPEG-2 TS? And how did you transmit OPUS over SRT?

getroot avatar Jun 18 '21 01:06 getroot

I compiled ffmpeg with srt and opus codec and used command like this: ffmpeg -re -i mp4file.mp4 -vcodec libx264 -vb 2M -acodec libopus -ab 192k -ac 2 -ar 48000 -f mpegts srt://...

fcqpl avatar Jun 18 '21 08:06 fcqpl

I can't find any documentation that can send OPUS over MPEG-2 TS. I thought OPUS/MPEG2-TS was not supported. If anyone knows this, I would be very grateful if you could send me a link to the documentation or information.

getroot avatar Jun 18 '21 09:06 getroot

I don't know if it's supported or not. But i wanna to move audio transcoding from Oven to encoding server. For now with +/- 14 streams Oven takes 80% CPU with audio encoding...

fcqpl avatar Jun 18 '21 10:06 fcqpl

You can avoid opus encoding if you use webrtc input. I will analyze ffmpeg in the future to try opus support.

getroot avatar Jun 18 '21 10:06 getroot

Just tested this with ffmpeg as caller and listener. While some codecs get assigned as Private data streams in ffmpeg opus seems to be muxed just fine and is automatically decoded on the receiving end (ffmpeg) while other codecs that get muxed as private data have to be manually extracted.

Morpheus235 avatar Jul 12 '21 15:07 Morpheus235

@getroot just +1'ing this request we could really use this in our workflow as well. there's an OPUS IRC and SRT Alliance Slack i can post in and see if i can get some info passed along.

mithrand1rr avatar Jul 15 '21 16:07 mithrand1rr

@getroot OPUS IRC for the win! ( https://kiwiirc.com/nextclient/#ircs://irc.libera.chat/opus )

Some links they provided.

MPEG TS Encap spec that they are working on. https://gitlab.xiph.org/xiph/opus-website/-/merge_requests/10/diffs?commit_id=f3b4351a15f4a05ca9afaa7e2d0b25266f54e578

Tips on checking how ffmpeg is handling the OPUS codec "https://github.com/mpv-player/mpv/issues/8678"

And apparently GStreamer is able to handle the OPUS codec if you wanted to look into that some. https://gstreamer.freedesktop.org/documentation/opus/opusdec.html?gi-language=c

Hope this helps! Happy to test anything you can come up with.

mithrand1rr avatar Jul 15 '21 18:07 mithrand1rr

@mithrand1rr Thanks for finding good information. I'll wait for OPUS/MPEG-TS to become an official standard.

As I have seen so far, FFMPEG still handles OPUS as a private stream of MPEG-TS, so it can be used only when the receiving end is aware that the private stream is OPUS in advance. This is not an acceptable method for streaming servers.

I will work on the OPUS/MPEG-TS draft you sent me when it becomes a formal specification. (Even before the document becomes the official version, a little bit in advance if I'm not busy)

getroot avatar Jul 16 '21 05:07 getroot

@getroot sounds good and totally understand! They sent an updated Draft docs last night here is the link https://opus-codec.org/docs/ETSI_TS_opus-v0.1.3-draft.pdf

I'll let you know if i hear any other updates. And feel free to let me know if there's something in the future to test out. Happy to lend a hand.

mithrand1rr avatar Jul 16 '21 16:07 mithrand1rr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '22 15:06 stale[bot]