RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

SRT Streaming issue

Open apdofficial opened this issue 2 years ago • 16 comments

Hello Pedro,

I have a question about the SRT client. Which version does the current implementation support?

I am trying to setup a connection to a OvenMediaEngine. The situation is as follows:

  • I first receive onConnectionStartedSrt callback
  • then I receive onConnectionSuccessSrt callback
  • then I send SPS, PPS and VPS bytes
  • then the log starts printing wrote VIDEO packet, size XXXX
  • so far so good

However, on the player side, there is no video coming. When I test the server with OBS studio as explained in this link (srt://ip:port?streamid=srt%3A%2F%2F{domain or IP address}[%3APort]%2F{App name}%2F{Stream name}) the stream is coming through. I noticed that in your library you expect the URL to be in the following form: srt://ip:port/streamid. Thus, I supply the link as follows: srt://ip:port/srt%3A%2F%2F{domain or IP address}[%3APort]%2F{App name}%2F{Stream name}.

My hypothesis is that the SRT socket connects successfully but the streamid is perhaps incorrectly supplied.

Any idea what could be the issue here?

Thank you for your response in advanced.

Regrads, Andrej

apdofficial avatar Nov 08 '23 09:11 apdofficial

Hello,

SRT is using version 1.4.4: https://github.com/pedroSG94/RootEncoder/blob/master/srt/src/main/java/com/pedro/srt/srt/packets/control/handshake/extension/HandshakeExtension.kt#L28

I will test it and report you back

pedroSG94 avatar Nov 08 '23 09:11 pedroSG94

Thanks for your quick reply! Awesome.

apdofficial avatar Nov 08 '23 10:11 apdofficial

How are you doing to reproduce the stream using a player? I'm using ffmpeg as encoder to test (it is used by OBS so it should be the same)

It is not working for me using docker from quick start guide: https://airensoft.gitbook.io/ovenmediaengine/quick-start#playback And player provided on github page: http://demo.ovenplayer.com/ I also tried using VLC or ffplay

pedroSG94 avatar Nov 08 '23 10:11 pedroSG94

We deployed OvenMediaEngine on a Ubuntu 22.04 VPS running docker and using their OME Docker Launcher:

After deployment one has to manually enable SRT in the OME config file (located at /opt/ovenmediaengine/bin/origin_conf/Server.xml)

The input stream URL that works by default after enabling SRT is: srt://example.com:9999?streamid=srt%3A%2F%2Fexample.com%3A9999%2Fapp%2Fstream

The playback URL that works by default is: ws://example.com:3333/app/stream

Using OBS, we found no problem using both H265 and H264 over SRT. We we're able to view the output stream via OME's demo player (be sure to use HTTP, not HTTPS, when visiting the website)

robinwesterik avatar Nov 08 '23 11:11 robinwesterik

Thank you, I will try that way

pedroSG94 avatar Nov 08 '23 11:11 pedroSG94

Using RootEncoder, we intermittently get adaptation header parsing errors on our OME logs:

[2023-11-08 11:18:22.591] I [SPSRT-s9999:21] SrtProvider | srt_provider.cpp:203  | The SRT client has connected : <ClientSocket: 0x7f7c362be010, #844379157, Connected, SRT, Nonblocking, 85.146.106.188:38443> [844379157] [srt%3A%2F%2Fexample.com%3A9999%2Fapp%2Fstream]
[2023-11-08 11:18:22.592] I [SPSRT-s9999:21] Provider | stream.cpp:49   | Unknown/stream(332) has been started stream
[2023-11-08 11:18:25.302] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:28.431] E [SPSRT-s9999:21] MPEGTS_DEPACKETIZER | mpegts_depacketizer.cpp:288  | Could not find section(PID: 0) for depacketizing
[2023-11-08 11:18:28.465] E [SPSRT-s9999:21] MPEGTS_DEPACKETIZER | mpegts_depacketizer.cpp:288  | Could not find section(PID: 0) for depacketizing
[2023-11-08 11:18:28.833] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:32.901] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:36.880] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:41.382] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:42.652] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:43.185] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:48.778] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:50.380] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:18:53.319] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
[2023-11-08 11:19:03.885] E [SPSRT-s9999:21] MPEGTS_DEPACKETIZER | mpegts_depacketizer.cpp:288  | Could not find section(PID: 0) for depacketizing
[2023-11-08 11:19:09.974] E [SPSRT-s9999:21] MPEGTS_PACKET | mpegts_packet.cpp:145  | Could not parse adaptation header
...

RootEncoder doesn't seem to give any errors, but the stream can not be played on OME.

robinwesterik avatar Nov 08 '23 12:11 robinwesterik

For now, I can reproduce the case and I'm working to find the reason.

pedroSG94 avatar Nov 08 '23 17:11 pedroSG94

After investigate it and some changes I was able to stream only audio. Video track is still bugged and I'm working to find the reason. You can follow this changes in this PR: https://github.com/pedroSG94/RootEncoder/pull/1336 I hardcoded my url test in OpenGl SRT example for testing. You can replace it and test if you want

pedroSG94 avatar Nov 09 '23 11:11 pedroSG94

Hello,

Finally it is working using the code in the branch: https://github.com/pedroSG94/RootEncoder/pull/1336

But only H264 is working. Using H265 you will have a black screen. I can't see that H265 is supported. Can you confirm me that it is supported?

I will fix tests and merge changes

pedroSG94 avatar Nov 11 '23 12:11 pedroSG94

Thanks for the quick fixes, they are much appreciated. As stated in the documentation, OME should support H265. I have confirmed this by streaming an H265 video feed via OBS.

robinwesterik avatar Nov 13 '23 08:11 robinwesterik

I see,

I will try to fix it. For now, you can use this gradle to test using H264 (this is the last commit of the fix branch):

implementation 'com.github.pedroSG94:RootEncoder:2981a93caf'

pedroSG94 avatar Nov 13 '23 08:11 pedroSG94

Thanks for the quick fixes, they are much appreciated. As stated in the documentation, OME should support H265. I have confirmed this by streaming an H265 video feed via OBS.

Which version of OBS and SO did you use to test? It is not available on Linux version: imagen

pedroSG94 avatar Nov 13 '23 17:11 pedroSG94

Thanks for the fixes, Pedro!

The H.264 SRT stream works; I just tested the fix branch. The H.265 still does not work, the bytes are sent but nothing is shown on the player side. The encoding depends on your hardware, whether you have an encoder which supports H.265, I think unless it can do CPU encoding. I've used a Macbook Pro with the ARM M1 Pro chip, which supports H.265 encoding.

FYI, maybe this will be useful: https://obsproject.com/forum/threads/obs-28-no-hevc-streaming-encoder-option.160539/

image

apdofficial avatar Nov 14 '23 08:11 apdofficial

Hello,

Thank you, I will try with my mac mini with M1 chip and OBS.

pedroSG94 avatar Nov 14 '23 10:11 pedroSG94

Hello Pedro,

@robinwesterik and me, we did some more testing. It turns out, to avoid the black screen on OME with H.265 you have to use LLHLS as the decoder. We tested SRT H.265 with OBS and LLHLS on the player side and it worked. (You have to use HTTP instead of HTTPS).

When streaming using the RootEncoder library with SRT and H.265, the OME logs are as follows:

[2023-11-14 10:13:14.419] I [SPSRT-s9999:21] Transcoder | transcoder_stream.cpp:46   | [#default#app/stream(492)] Transcoder stream has been started
[2023-11-14 10:13:14.421] I [SPSRT-s9999:21] Provider | stream.cpp:364  | [PTS] Wrap around detected. track:32
[2023-11-14 10:13:14.421] I [SPSRT-s9999:21] Provider | stream.cpp:385  | [DTS] Wrap around detected. track:32
[2023-11-14 10:13:14.423] I [SPSRT-s9999:21] SrtProvider | srt_provider.cpp:342  | SrtProvider::OnDisonnected : <ClientSocket: 0x7f7c36273010, #844379132, Error, SRT, Nonblocking, 85.146.106.188:46079> [srt%3A%2F%2Fomeh265.iotrobor.nl%3A9999%2Fapp%2Fstream]

Let us know in case of any questions.

apdofficial avatar Nov 14 '23 10:11 apdofficial

Hello,

I was testing with OBS with my MacMini M1 and I have exactly the same problem that with my library. Black screen video but audio working using wss source and never load using HLS LL source. I let you a video here:

https://github.com/pedroSG94/RootEncoder/assets/17556876/b98d7527-1e35-4cbb-a2fb-7bf64ed96132

As you can see in the video you have wireshark to make sure that streaming is working where you can see the server IP in destination that is the same that the used in OBS and player.

I also tested using SRT url encoded as suggested in the tutorial but with the same result. I tested using H264 and it is working fine:

Captura de pantalla 2023-11-15 a las 22 09 15

Tested using: Mac mini M1 2020, 8GB ram, macOS Sonoma 14.0 OBS Studio 30.0 (apple silicon arm version) with H264 and HEVC apple hardware encoder OvenMediaEngine 16.0 (using docker provided in quick start guide) Player without TLS provided in github readme (you can check in the video that it is not secure connection in the browser url bar)

pedroSG94 avatar Nov 15 '23 21:11 pedroSG94

Closing as inactive.

pedroSG94 avatar Feb 26 '24 11:02 pedroSG94