ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.16k stars 5.31k forks source link

If there is no audio when streaming through the browser using WebRTC, the distributed HLS fails to play on Safari. #3619

Closed galaxy-s10 closed 4 months ago

galaxy-s10 commented 1 year ago

Note: Please read the FAQ before filing an issue, see #2716

Description

When streaming through the browser using WebRTC without audio, the distributed HLS fails to play on Safari but plays normally on Chrome. When streaming with audio, the distributed HLS plays normally on both Safari and Chrome.

When comparing the TS files with and without audio using FFmpeg, the following prompt is displayed for the TS file without audio:

  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mpegts @ 0x124704280] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x124704280] stream 0 : no TS found at start of file, duration not set
[mpegts @ 0x124704280] Could not find codec parameters for stream 0 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from '/Users/huangshuisheng/Desktop/docker/srs/objs/nginx/html/livestream/roomId___101-313.ts':
  Duration: 00:00:05.53, start: 46205.826711, bitrate: 891 kb/s
  Program 1 
  Stream #0:0[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp

If there is audio in the TS file, this prompt is not displayed:

  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mpegts, from '/Users/huangshuisheng/Desktop/docker/srs/objs/nginx/html/livestream/roomId___3-0.ts':
  Duration: 00:00:10.17, start: 0.077000, bitrate: 765 kb/s
  Program 1 
  Stream #0:0[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 129 kb/s

Please describe your issue here.

  1. SRS Version: 5.0

  2. SRS Log:

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
  1. SRS Config:
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx

Replay

Please describe how to replay the bug.

Step 1: xxxxxx

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx

Step 2: xxxxxx

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx

Step 3: xxxxxx

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx

Expect

Please describe your expectation.

TRANS_BY_GPT3

galaxy-s10 commented 1 year ago

Is this a problem with Safari browser (because other browsers are fine), has anyone encountered it?

TRANS_BY_GPT3

xiaozhihong commented 1 year ago

It could be a Safari issue, or it could be a problem with the TS segments cut by SRS. Let me take a look first.

TRANS_BY_GPT3

galaxy-s10 commented 1 year ago

Actually, it is resolved. It was a problem with Safari, similar to this issue: https://github.com/ossrs/srs/issues/1326.

TRANS_BY_GPT3

winlinvip commented 4 months ago

Impossible to fix it but workaround, and it's a known issue, see https://github.com/ossrs/srs/issues/1326#issuecomment-2041228765