AirenSoft / OvenMediaEngine

OvenMediaEngine (OME) is a Sub-Second Latency Live Streaming Server with Large-Scale and High-Definition. #WebRTC #LLHLS
https://airensoft.com/ome.html
GNU Affero General Public License v3.0
2.61k stars 1.06k forks source link

Configuring OvenMediaEngine to stream LL-HLS with RTSP input #1046

Closed deekshithkv closed 1 year ago

deekshithkv commented 1 year ago

Hi, I have installed and build OvenMediaEngine in ubuntu 20.04 as per document provided. I have used RTSP stream from camera as input (RTSP pull), configured OME to serve LL-HLS and OvenPlayer to test the LL-HLS stream. The issue is while loading the video in the player i see a initial delay of around 15-20 sec before playback begins. Is this expected? I am attaching a Wireshark screenshot it shows that for the 1st GET request OME takes around 10-15sec to respond. Can you please provide some details why this delay happens or way to reduce the same? Capture

getroot commented 1 year ago
  1. LL-HLS can be delivered only after creating a segment. Theoretically, since it is LL-HLS, it is possible to start playback even if only about 3 partial segments are created. However, some players may malfunction if they receive a playlist response before at least one full segment is created. So OME starts responding once at least 1 full segment has been created.

  2. Try reducing the SegmentDuration to 2 or 3 seconds to make segments faster.

<Publishers>
    <LLHLS>
        <ChunkDuration>0.5</ChunkDuration>
        <SegmentDuration>2</SegmentDuration>
        <SegmentCount>10</SegmentCount>
  1. Nevertheless, if the segment is created late, check the keyframe interval of the input stream. HLS segments must start with a keyframe. Therefore, the longer the keyframe interval, the longer it takes to create segments.

  2. For this reason, it is recommended to create an LL-HLS stream in advance and start playing it. Since the player plays the last partial segment, the above reason does not add any delay.

  3. Try playing with WebRTC. It starts quickly.

deekshithkv commented 1 year ago

thank you very much for your response. It is really helpful. One more issue we faced is that the latency gradually increases with time. Is there any reported issue? or is there a way to fix it?

naanlizard commented 1 year ago

Generally speaking, I see latency grow with RTMP input if the encoder can't keep up. Is that possibly what's happening with your RTSP source?

getroot commented 1 year ago

Bugs that OME increase latency have not been reported yet. However, as @naanlizard said, the problem of input stream (encoder, network) was the most common cause. Or there was a cause of the performance of the server that the OME worked. Or because the player's network is slow, latency continues to increase.

Of course, there may be many causes. So if you want to accurately analyze your problem, upload the information required by the Template of this document (server.xml, ovenmediaengine.log file, player information, encoder information).

deekshithkv commented 1 year ago

Thank you for your reply, we will look in to it soon. One more issue we faced is that OME is waiting 5sec for RTCP, Log: [2023-02-28 03:55:51.256] W [StreamMotor:3663] RtspcStream | rtspc_stream.cpp:984 | Since the RTCP SR was not received within 5 seconds, the PTS is calculated for each track without RTCP SR. (Lip-Sync may be out of sync) We only send video from camera and no RTCP packet is send, so is there a way to avoid/configure this 5sec wait and reduce initial playback delay.

getroot commented 1 year ago

OvenMediaEngine very strongly recommends that clients send RTCP SRs. There are probably many smart ways to handle exceptions, but such tasks are usually very low priority to me.