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.32k stars 5.33k forks source link

WebRTC: FLV by ffplay/H5/VLC is ok, RTMP by VLC is failed #3307

Open AlanQtten opened 1 year ago

AlanQtten commented 1 year ago

rtc2rtmp, rtc plays normally, rtmp cannot play

  1. SRS Version: xxxxxx 5.0.108

  2. SRS Log: See the comment file.

  3. SRS Config:


listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
    https {
        enabled on;
        listen 8081;
        key https.key;
        cert https.pem;
    }
}

http_api {
    enabled         on;
    listen          1985;
    https {
        enabled on;
        listen 443;
        key https.key;
        cert https.pem;
    }
}
stats {
    network         0;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    # candidate $CANDIDATE;
    candidate: my public IP address;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        # rtmp_to_rtc on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        nack on;
        twcc on;
        rtc_to_rtmp on;
        pli_for_rtmp 2.0;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

Replay (重现)

1. Open the website (my personal Alibaba Cloud, deployed with SRS) https://www.sayhelloworld.cn:8081/players/rtc_publisher.html 2. Push RTC stream webrtc://www.sayhelloworld.cn/live/livestream 3. Open VLC player
(At this time, you can play normally using https://www.sayhelloworld.cn:8081/players/rtc_player.html) rtmp://www.sayhelloworld.cn/live/livestream VLC player error, unable to play

Expect (Expected Behavior) Normal playback

TRANS_BY_GPT3

AlanQtten commented 1 year ago

srs.log

winlinvip commented 1 year ago

Tried it out, there is a chance of 5.0 appearing.

./objs/srs -c conf/console.conf

Streaming: http://localhost:8080/players/rtc_publisher.html?schema=http

ffplay normal: ffplay rtmp://localhost/live/livestream

H5 playback of HTTP-FLV is normal: http://localhost:8080/players/srs_player.html?schema=http

Playing FLV with VLC is also normal: http://localhost:8080/live/livestream.flv

Playing RTMP with VLC results in a black screen: rtmp://localhost/live/livestream

image

VLC error message:

image

The log is as follows: play.log publisher.log srs.log

grep zp0v389j srs.log
[2022-12-15 19:29:06.737][INFO][99372][zp0v389j] RTMP client ip=127.0.0.1:53981, fd=15, trace=, span=
[2022-12-15 19:29:06.739][INFO][99372][zp0v389j] complex handshake success
[2022-12-15 19:29:06.739][INFO][99372][zp0v389j] connect app, tcUrl=rtmp://localhost:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=localhost, port=1935, app=live, args=null
[2022-12-15 19:29:06.739][INFO][99372][zp0v389j] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2022-12-15 19:29:06.739][INFO][99372][zp0v389j] ignore AMF0/AMF3 command message.
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] ignore AMF0/AMF3 command message.
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] client identified, type=rtmp-play, vhost=localhost, app=live, stream=livestream, param=, duration=-1ms
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] connected stream, tcUrl=rtmp://localhost:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live, stream=livestream, param=, args=null
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] source url=/live/livestream, ip=127.0.0.1, cache=1/2500, is_edge=0, source_id=15574p9l/z220f1a1
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] dispatch cached gop success. count=0, duration=9
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] create consumer, active=1, queue_size=0.00, jitter=30000000
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] set fd=15, SO_SNDBUF=146988=>87500, buffer=350ms
[2022-12-15 19:29:06.740][INFO][99372][zp0v389j] start play smi=0ms, mw_sleep=350, mw_msgs=8, realtime=0, tcp_nodelay=0
[2022-12-15 19:29:09.679][INFO][99372][zp0v389j] -> PLA time=2578731, msgs=11, okbps=0,0,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:29:19.807][INFO][99372][zp0v389j] -> PLA time=12698264, msgs=28, okbps=0,0,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:29:29.887][INFO][99372][zp0v389j] -> PLA time=22784358, msgs=28, okbps=0,0,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:29:40.167][INFO][99372][zp0v389j] -> PLA time=33070796, msgs=28, okbps=0,433,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:29:50.247][INFO][99372][zp0v389j] -> PLA time=43141633, msgs=28, okbps=0,433,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:30:00.324][INFO][99372][zp0v389j] -> PLA time=53236897, msgs=27, okbps=0,433,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:30:10.647][INFO][99372][zp0v389j] -> PLA time=63540208, msgs=28, okbps=0,440,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:30:20.641][INFO][99372][zp0v389j] -> PLA time=73633653, msgs=20, okbps=0,440,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:30:30.767][INFO][99372][zp0v389j] -> PLA time=83667713, msgs=28, okbps=0,440,0, ikbps=0,0,0, mw=350/8
[2022-12-15 19:30:31.127][INFO][99372][zp0v389j] TCP: before dispose resource(RtmpConn)(0x612000063640), conns=1, zombies=0, ign=0, inz=0, ind=0
[2022-12-15 19:30:31.127][WARN][99372][zp0v389j][54] client disconnect peer. ret=1007
[2022-12-15 19:30:31.127][INFO][99372][zp0v389j] TCP: disposing #0 resource(RtmpConn)(0x612000063640), conns=1, disposing=1, zombies=0

TRANS_BY_GPT3

AlanQtten commented 1 year ago

@winlinvip So is this a problem only in version 5.0? Should I downgrade my SRS version?

TRANS_BY_GPT3

winlinvip commented 1 year ago

You try 4.0, I only tried 5.0 and there is a chance of it appearing.

TRANS_BY_GPT3