AirenSoft / OvenMediaEngine

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

Thumbnail generation adds delay to stream start #1417

Closed d-uzlov closed 7 months ago

d-uzlov commented 10 months ago

Describe the bug

When you enable thumbnail generation, stream start is delayed by approximately 3 x <time to generate a thumbnail>. This is critical when thumbnail framerate is low. If framerate is 0.1, stream start is delayed by 30 seconds. If framerate is 0.05, stream start is delayed by 60 seconds.

To Reproduce

  1. Enable thumbnails as described here:
  2. Set low thumbnail framerate:
                <Image>
                    <Codec>jpeg</Codec>
                    <Height>480</Height>
                    <Framerate>0.1</Framerate>
                </Image>
  3. Open player, wait for the stream to start
  4. Increase framerate to 1, repeat the test.

Expected behavior

Thumbnails are not related to video and audio streams, so they shouldn't affect stream delay. Stream in player should start in less than a second after OBS started streaming.

Logs

ome.log

Server (please complete the following information):

docker build https://github.com/AirenSoft/OvenMediaEngine/raw/4d2e46621eeca9371de5199250b3367d37c11fb2/Dockerfile.cuda \
    --build-arg OME_VERSION=v0.16.0

Player:

Additional context

I'm running trascoding with the following settings:

Click me ```xml tc live true bypass_stream ${OriginStreamName} transcode_webrtc webrtc_bypass bypass transcode_webrtc webrtc bypass 1080p 720p transcode_hls hls bypass 1080p 720p jpeg 480 0.1 30000 * 1 8 30000 false false false true 0.5 1.5 6 10 * * ```
Keukhan commented 10 months ago

@d-uzlov

Thank you for reporting on this unexpected part. Currently, streaming is possible in Publisher only when frames are created in all tracks. If the frame rate value was small, the first frame was created late, which was the cause of the problem. I will make improvements to force the creation of the first frame when encoding images.

I'll let you know when the patch is complete.

Thanks.

Keukhan commented 8 months ago

@d-uzlov

As I work to make money for a living, Only now was I able to solve the problem. :) It has been patched in the master branch and will be available in the next version release. Thank you for waiting.

https://github.com/AirenSoft/OvenMediaEngine/compare/84aed379b4da...d3e69511055b

d-uzlov commented 7 months ago

I see 0.16.4 was released recently. I tested low thumbnail framerate, and it seems to be starting without any delay. Thanks for fixing it!