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

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

Closed
timfengzi opened this issue Aug 30, 2021 · 8 comments · Fixed by #2470
Closed

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

timfengzi opened this issue Aug 30, 2021 · 8 comments · Fixed by #2470
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Milestone

Comments

@timfengzi
Copy link

timfengzi commented Aug 30, 2021

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

@winlinvip winlinvip added Bug It might be a bug. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. labels Aug 30, 2021
@winlinvip winlinvip added this to the SRS 4.0 release milestone Aug 30, 2021
@winlinvip
Copy link
Member

winlinvip commented Aug 30, 2021

Lack of logs, so please ask Master Zhihong to see if it can be reproduced. If it cannot be reproduced, I will delete it.

TRANS_BY_GPT3

@timfengzi
Copy link
Author

timfengzi commented Aug 31, 2021

Does the original design have the functionality of webrtc to hls? I saw in the documentation that it doesn't. I originally wanted to convert webrtc to rtmp and then to hls, but testing showed that it doesn't work. The video is in h264+aac format. Also, there is an issue where the resolution changes when pushing the webrtc stream, rendering the recorded mp4 file useless.

TRANS_BY_GPT3

@timfengzi
Copy link
Author

timfengzi commented Aug 31, 2021

This problem seems to be the same as #2470.

TRANS_BY_GPT3

@akanchi
Copy link
Contributor

akanchi commented Sep 7, 2021

Try deleting the hls_path ./conf/m3u8; line in the configuration file?

TRANS_BY_GPT3

@timfengzi
Copy link
Author

timfengzi commented Sep 8, 2021

Try deleting hls_path ./conf/m3u8; from the configuration file and see if it works?

After upgrading to version 161, there are no issues with HLS. However, when the resolution is set to 1080p, it is unable to record MP4 files and only records a few kilobytes.

TRANS_BY_GPT3

@akanchi
Copy link
Contributor

akanchi commented Sep 9, 2021

[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]

Now recording mp4 does not support resolution changes

TRANS_BY_GPT3

@timfengzi
Copy link
Author

timfengzi commented Sep 9, 2021

[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]

Now recording mp4 does not support resolution changes.

It is automatically changed by WebRTC... How can it be fixed?
image

TRANS_BY_GPT3

@xiaozhihong xiaozhihong linked a pull request Nov 10, 2021 that will close this issue
@xiaozhihong
Copy link
Collaborator

xiaozhihong commented Nov 10, 2021

Already resolved, closed.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title srs4.0能不能webrtc转hls播放 Can srs4.0 convert webrtc to hls for playback? Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants