Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari plays HLS streamed out by OWT incorrectly. #1331

Open
GStarP opened this issue Jul 6, 2023 · 3 comments
Open

Safari plays HLS streamed out by OWT incorrectly. #1331

GStarP opened this issue Jul 6, 2023 · 3 comments

Comments

@GStarP
Copy link

GStarP commented Jul 6, 2023

We build such flow: WebRTC(Browser) => publish and mix into view "common"(OWT) => streaming out as RTMP(NMS/SRS) => play by Safari <video>(HSL). We also tried generating HLS files directly from OWT and serve them by express.js for safari to request, but the problem remains the same.

The problem is that after normally played for abount 1min, the video keeps still (the video screen not change any more). However, in browser developer tool, we can see .m3u8 and .ts files are still being requested correctly, you can even download .ts and play!

By the way, Chrome on Android and Windows can play the same url using https://livepush.io/hls-player/index.html. It seems that only Safari <video> doesn't work well with OWT streaming out.

A recurrent reference:

  • WebRTC video stream: 1920x1080, h264(CB), 30fps (no audio)
  • OWT mixed stream: 1920x1080, h264(CB), 30fps; opus/48000/2
  • Streaming out config: just provide audioId and videoId, no other configs
@GStarP GStarP changed the title Safari plays HLS streamed out by OWT error. Safari plays HLS streamed out by OWT incorrectly. Jul 6, 2023
@starwarfan
Copy link
Collaborator

Are there any quality changes(such as resolution, bitrate) of your HLS streaming when video starts to freeze in safari?

@GStarP
Copy link
Author

GStarP commented Jul 7, 2023

Are there any quality changes(such as resolution, bitrate) of your HLS streaming when video starts to freeze in safari?

Accroding to ffprobe ${url}, output keeps showing as bellow, no changes:

Input #0, hls, from '${url}':
  Duration: N/A, start: 85.378000, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
  Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
  Stream #0:1: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080, 31 tbr, 90k tbn
    Metadata:
      variant_bitrate : 0

@GStarP
Copy link
Author

GStarP commented Jul 7, 2023

New progress!
A temporary solution is using SRS transcode to create another 1280x720 stream, Safari can play this new stream correctly.

New routes: streaming out to rtmp://x.x.x.x/stream1 (SRS) => transcoding to rtmp://x.x.x.x/stream2 (SRS), then you can play http://x.x.x.x/stream2.m3u8 in Safari correctly.

SRS config reference:

vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    transcode {
        enabled on;
        ffmpeg /usr/bin/ffmpeg;
        engine 720p {
            enabled on;
            vcodec libx264;
            vwidth 1280;
            vheight 720;
            vprofile main;
            vpreset medium;

            acodec copy;

            output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_720p;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants