Skip to content

Can srs4.0 convert webrtc to hls for playback? #2561

@timfengzi

Description

@timfengzi

Note: Issues that do not provide the following information will be deleted directly (Please follow the issue template, or we will delete it)'

Note: For inquiries and discussions, please submit them to the SRS forum (Please ask questions at) http://bbs.ossrs.net

Description

Please describe your issue here.

  1. SRS version: 4.0
  2. The log of SRS is as follows:
[2021-08-31 01:27:04.637][Trace][1][03877010] RTC: session address change 113.71.138.158:58714 -> 113.69.42.179:11854, cached=1, nn_change=2/1, nn_address=2
[2021-08-31 01:27:04.637][Warn][1][03877010][11] VIDEO: stream not monotonically increase, please open mix_correct.
[2021-08-31 01:27:04.637][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.1, 720x416, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:04.637][Trace][1][03877010] set ts=4284641379, header=30743, lost=30744
[2021-08-31 01:27:04.637][Trace][1][03877010] NACK: update seq=30743, nack range [30743, 30752]
[2021-08-31 01:27:04.700][Trace][1][03877010] -> HLS time=474358740ms, sno=7839, ts=livestream12-7838.ts, dur=0.00, dva=0p
[2021-08-31 01:27:04.873][Trace][1][03877010] NACK: update seq=30758, nack range [30756, 30758]
[2021-08-31 01:27:04.875][Warn][1][v8xac3r5][11] handle udp pkt, count=10/10, err: code=5015 : size=54, data=[90 7d 78 17 ff 62 70 63] : marker=0, pt=125, seq=30743, ts=4284641379, ssrc=383066872, pad=0, payload=34B : rtp unprotect r0=9
thread [1][v8xac3r5]: cycle() [src/app/srs_app_listener.cpp:630][errno=11]
thread [1][03877010]: on_rtp() [src/app/srs_app_rtc_conn.cpp:1309][errno=11]
thread [1][03877010]: unprotect_rtp() [src/app/srs_app_rtc_dtls.cpp:1145][errno=11]
[2021-08-31 01:27:04.924][Trace][1][03877010] NACK: update seq=30760, nack range [30759, 30760]
[2021-08-31 01:27:04.936][Trace][1][qygp40tz] Hybrid cpu=0.00%,18MB, cid=36,6, timer=62,10,47, clock=0,42,5,0,0,0,0,0,0, free=1, objs=(pkt:490,raw:48,fua:442,msg:639,oth:1,buf:269)
[2021-08-31 01:27:04.936][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(140,rtp:136,stun:1,rtcp:2), spkts=(8,rtp:0,stun:1,rtcp:12), rtcp=(pli:1,twcc:5,rr:1), snk=(49,a:24,v:24,h:1), fid=(id:1,fid:140,ffid:0,addr:1,faddr:140)
[2021-08-31 01:27:04.988][Trace][1][qygp40tz][MAYBE] RTC: NACK timeout=1, request PLI, track=55087aa2-378c-4b27-884b-a2734e35f8e3, ssrc=383066872
[2021-08-31 01:27:08.502][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.2, 960x544, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:08.502][Warn][1][03877010][11] dvr: ignore video error code=3085 : write video : encode video : write sample : doesn't support avcc change
thread [1][03877010]: on_video() [src/app/srs_app_dvr.cpp:651][errno=11]
thread [1][03877010]: write_video() [src/app/srs_app_dvr.cpp:146][errno=11]
thread [1][03877010]: encode_video() [src/app/srs_app_dvr.cpp:503][errno=11]
thread [1][03877010]: copy_sequence_header() [src/kernel/srs_kernel_mp4.cpp:5999][errno=11]
[2021-08-31 01:27:08.502][Trace][1][03877010] set ts=4284988599, header=31347, lost=31348
[2021-08-31 01:27:09.936][Trace][1][qygp40tz] Hybrid cpu=4.00%,19MB, cid=9,4, timer=62,3,17, clock=0,45,3,1,0,0,0,0,0, free=1, objs=(pkt:137,raw:22,fua:115,msg:189,oth:1,buf:77)
[2021-08-31 01:27:09.936][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(140,rtp:136,stun:1,rtcp:2), spkts=(8,rtp:0,stun:1,rtcp:12), rtcp=(pli:1,twcc:5,rr:1), snk=(49,a:24,v:24,h:1), fid=(id:1,fid:140,ffid:0,addr:1,faddr:140)
[2021-08-31 01:27:13.158][Trace][1][qygp40tz] RTC: Need PLI ssrc=383066872, play=[qygp40tz], publish=[03877010], count=1/1
[2021-08-31 01:27:13.158][Trace][1][03877010] RTC: Request PLI ssrc=383066872, play=[qygp40tz], count=1/1, bytes=12B
[2021-08-31 01:27:13.218][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.2, 960x544, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:13.218][Trace][1][03877010] set ts=4285414299, header=32374, lost=32375
[2021-08-31 01:27:14.478][Trace][1][v8xac3r5] <- RTC RECV #10, udp 2488, pps 227/248, schedule 2488
[2021-08-31 01:27:14.718][Trace][1][03877010] -> HLS time=484384358ms, sno=7946, ts=livestream12-7945.ts, dur=0.00, dva=0p
[2021-08-31 01:27:14.936][Trace][1][qygp40tz] Hybrid cpu=4.00%,19MB, cid=9,4, timer=62,3,17, clock=0,45,3,1,0,0,0,0,0, free=1, objs=(pkt:137,raw:22,fua:115,msg:189,oth:1,buf:77)
[2021-08-31 01:27:14.936][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(258,rtp:252,stun:1,rtcp:4), spkts=(14,rtp:0,stun:1,rtcp:24), rtcp=(pli:1,twcc:9,rr:1), snk=(96,a:48,v:48,h:1), fid=(id:0,fid:258,ffid:0,addr:1,faddr:258)
[2021-08-31 01:27:19.937][Trace][1][qygp40tz] Hybrid cpu=3.00%,19MB, cid=9,4, timer=62,3,17, clock=0,45,3,1,0,0,0,0,0, free=1, objs=(pkt:137,raw:22,fua:115,msg:189,oth:1,buf:77)
[2021-08-31 01:27:19.937][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(258,rtp:252,stun:1,rtcp:4), spkts=(14,rtp:0,stun:1,rtcp:24), rtcp=(pli:1,twcc:9,rr:1), snk=(96,a:48,v:48,h:1), fid=(id:0,fid:258,ffid:0,addr:1,faddr:258)
[2021-08-31 01:27:23.215][Trace][1][qygp40tz] RTC: Need PLI ssrc=383066872, play=[qygp40tz], publish=[03877010], count=2/2
[2021-08-31 01:27:23.215][Trace][1][03877010] RTC: Request PLI ssrc=383066872, play=[qygp40tz], count=2/2, bytes=12B
[2021-08-31 01:27:23.279][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.2, 960x544, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:23.279][Trace][1][03877010] set ts=4286319969, header=34678, lost=34679
[2021-08-31 01:27:24.488][Trace][1][v8xac3r5] <- RTC RECV #10, udp 2862, pps 228/285, schedule 2862
[2021-08-31 01:27:24.718][Trace][1][03877010] -> HLS time=494387469ms, sno=8113, ts=livestream12-8112.ts, dur=0.00, dva=67p
[2021-08-31 01:27:24.937][Trace][1][qygp40tz] Hybrid cpu=3.00%,19MB, cid=35,6, timer=62,11,48, clock=0,44,4,1,0,0,0,0,0, objs=(pkt:505,raw:50,fua:455,msg:659,oth:1,buf:278)
[2021-08-31 01:27:24.937][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(258,rtp:252,stun:1,rtcp:4), spkts=(14,rtp:0,stun:1,rtcp:24), rtcp=(pli:1,twcc:9,rr:1), snk=(96,a:48,v:48,h:1), fid=(id:0,fid:258,ffid:0,addr:1,faddr:258)
[2021-08-31 01:27:29.834][Trace][1][03877010] RTC: session address change 113.69.42.179:11854 -> 113.71.138.158:58714, cached=1, nn_change=3/2, nn_address=2
[2021-08-31 01:27:29.937][Trace][1][qygp40tz] Hybrid cpu=3.00%,19MB, cid=35,6, timer=62,11,48, clock=0,44,4,1,0,0,0,0,0, objs=(pkt:505,raw:50,fua:455,msg:659,oth:1,buf:278)
[2021-08-31 01:27:29.937][Trace][1][qygp40tz] RTC: Server conns=1, rpkts=(283,rtp:277,stun:1,rtcp:5), spkts=(14,rtp:0,stun:1,rtcp:23), rtcp=(pli:1,twcc:9,rr:1), snk=(97,a:48,v:48,h:0), fid=(id:0,fid:283,ffid:0,addr:1,faddr:283)
[2021-08-31 01:27:30.667][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.2, 960x544, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:30.667][Trace][1][03877010] set ts=4286985519, header=36351, lost=36352
[2021-08-31 01:27:31.843][Trace][1][03877010] RTC: session address change 113.71.138.158:58714 -> 113.69.42.179:11854, cached=1, nn_change=4/2, nn_address=2
[2021-08-31 01:27:33.272][Trace][1][qygp40tz] RTC: Need PLI ssrc=383066872, play=[qygp40tz], publish=[03877010], count=3/3
[2021-08-31 01:27:33.273][Trace][1][03877010] RTC: Request PLI ssrc=383066872, play=[qygp40tz], count=3/3, bytes=12B
[2021-08-31 01:27:33.347][Trace][1][03877010] 35B video sh,  codec(7, profile=Baseline, level=3.2, 960x544, 0kbps, 0.0fps, 0.0s)
[2021-08-31 01:27:33.347][Trace][1][03877010] set ts=4287225459, header=36975, lost=36976
[2021-08-31 01:27:34.485][Trace][1][v8xac3r5] <- RTC RECV #10, udp 2845, pps 229/284, schedule 2845
[2021-08-31 01:27:34.750][Trace][1][03877010] -> HLS time=504421179ms, sno=8282, ts=livestream12-8281.ts, dur=0.00, dva=0p
  1. The configuration of SRS is as follows:
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api {
    enabled         on;
    listen          1985;
}
stats {
    network         0;
}
rtc_server {
    enabled on;
    # Listen at udp://8000
    listen 8000;
    #
    # The $CANDIDATE means fetch from env, if not configed, use * as default.
    #
    # The * means retrieving server IP automatically, from all network interfaces,
    # @see https://github.com/ossrs/srs/wiki/v4_CN_RTCWiki#config-candidate
    candidate $CANDIDATE;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        rtc_to_rtmp on;
        pli_for_rtmp 10;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled         on;
        dvr_path        ./conf/[app]/[stream].[timestamp].mp4;
    }
    hls {
        enabled         on;
        hls_cleanup     off;
        hls_fragment    10;
        hls_path        ./conf/m3u8;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
    }
}

Replay

How to replay bug?

  1. WebRTC streaming
  2. Unable to play using HLS
  3. RTMP works, but the TS file is only a few kilobytes. Streaming with RTMP is possible.

Expected behavior

> Describe your expectation

TRANS_BY_GPT3

Metadata

Metadata

Assignees

Labels

BugIt might be a bug.TransByAITranslated by AI/GPT.WebRTCWebRTC, RTC2RTMP or RTMP2RTC.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions