ossrs / srs

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

webrtc live streaming, rtmp playback, video buffering is noticeable #2720

Closed jamken closed 2 years ago

jamken commented 3 years ago

Description'

Please ensure that the markdown structure is maintained.

Currently, the rtc2rtmp function is being used, but during actual testing, there is a consistent issue of stuttering in rtmp playback. Analyzing the timestamps of the rtmp stream's audio and video frames, it is observed that SRS (Streaming Relay Server) periodically loses a portion of video frames, resulting in a period of time where only audio frames are present without any video frames. After 1 to 2 seconds, the video frames reappear.

Additional information:

  1. If rtc playback is used, the video is continuous.
  2. The audio frames are consistently continuous without any stuttering.

Please ensure that the markdown structure is maintained.

  1. SRS version: xxxxxx

Please ensure that the markdown structure is maintained.

4.0.161

  1. The log of SRS is as follows:

Please ensure that the markdown structure is maintained.

The log is in the attachment.

Please ensure that the markdown structure is maintained.
  1. The configuration of SRS is as follows (Config):

Please ensure that the markdown structure is maintained.

listen 1935;
pid srs.pid;
srs_log_tank file;
srs_log_level trace;
srs_log_file ./logs/srs.log;
max_connections 1000;
da
[srs.txt](https://github.com/ossrs/srs/files/7491698/srs.txt)
emon off;
asprocess on;
[srs.txt](https://github.com/ossrs/srs/files/7491591/srs.txt)

http_server {
    enabled         on;
    listen          0.0.0.0:1936;
    dir             ./html;
}

http_api {
    enabled         on;
    listen          0.0.0.0:1985;
    crossdomain     on;
}

rtc_server {
    enabled on;
    listen 8000;
    candidate *;
}

vhost __defaultVhost__ {
    rtc {
        enabled on;
        nack on;
        twcc on;
        rtc_to_rtmp on;
        pli_for_rtmp 2.0;
    }

    hls {
        enabled on;
        hls_fragment 1.5;
        hls_window 20;
        hls_td_ratio 1.5;
        hls_path /opensight/nginx/html/hls_srs/hls_srs;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
        hls_wait_keyframe on;
        hls_dispose     20;
    }

    http_hooks {
        enabled on;
        on_publish http://127.0.0.1:1938/api/srsproxy/v1/srscbk;
        on_unpublish http://127.0.0.1:1938/api/srsproxy/v1/srscbk;
        on_play http://127.0.0.1:1938/api/srsproxy/v1/srscbk;
    }

    http_remux {
        enabled     on;
        mount       [vhost]/flv_srs/[app]/[stream].flv;
    }

    play{
        gop_cache       on;
        queue_length    10;
        mw_latency      20;
        reduce_sequence_header  on;
        time_jitter     off;
        mix_correct     off;
    }

    min_latency     on;
    tcp_nodelay     on;
}

Replay

Please ensure that the markdown structure is maintained.

How to replay bug?

Please ensure that the markdown structure is maintained.

Steps to reproduce the bug:

  1. Start WebRTC streaming with Chrome, using 1080P video.
  2. Use RTMP to pull the stream (e.g., using VLC).
  3. Observe continuous audio but video stuttering and jumping.

Expected behavior:

The video and audio should both stream smoothly without any stuttering or jumping.

RTMP pulling stream, both audio and video should be relatively smooth.

TRANS_BY_GPT3

jamken commented 3 years ago

srs.txt

winlinvip commented 2 years ago

Fixed by #2721