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

When RTMP is pushed, the address in HTTP-FLV does not match, where 'live' becomes 'liv'. #2805

Closed dzxiang closed 2 years ago

dzxiang commented 2 years ago

Description'

Please ensure that the markdown structure is maintained.

Push streaming address (part of IP address replaced with *):'

Please ensure that the markdown structure is maintained. rtmp://18.5.21*.38:1935/live/3abacde4f0da4f42a2ba384321aa44fd

The resulting pull streaming address has become:'

Please ensure that the markdown structure is maintained. http://18*.5*.21*.38:7080/liv/3abacde4f0da4f42a2ba384321aa44fd.flv

The "live" part has changed to "liv", strangely enough, it started working again after switching to another server.

Please ensure that the markdown structure is maintained.

I use Docker to start the SRS server. The shell script used for starting is as follows:

Please ensure that the markdown structure is maintained.

#!/bin/sh
docker stop srs
docker rm srs

docker run -d --restart always -m 2g --memory-swap=2g \
--name srs \
--network=host \
-v `pwd`/conf:/usr/local/srs/conf \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 ./objs/srs -c conf/srs.conf
  1. SRS version: 4.0.206

Please ensure that the markdown structure is maintained.

  1. SRS log:

Please ensure that the markdown structure is maintained.

[2021-12-22 03:03:33.914][Trace][1][f6d110xn] HTTP #227 113.110.227.10:51232 GET http://183.56.214.38:1985/api/v1/summaries?callback=angular.callbacks._3d5, content-length=-1
[2021-12-22 03:03:36.733][Trace][1][2k617qs4] Hybrid cpu=1.00%,13MB, cid=1,0, timer=63,0,0, clock=0,49,0,0,0,0,0,0,0
[2021-12-22 03:03:37.912][Trace][1][f6d110xn] HTTP #228 113.110.227.10:51232 GET http://183.56.214.38:1985/api/v1/summaries?callback=angular.callbacks._3d6, content-length=-1
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] HTTP #0 113.110.227.10:51979 GET http://183.56.214.38:7080/live/3abacde4f0da4f42a2ba384321aa44fd.flv, content-length=-1
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] new source, stream_url=/live/3abacde4f0da4f42a2ba384321aa44fd
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] http: mount flv stream for sid=/live/3abacde4f0da4f42a2ba384321aa44fd, mount=/live/3abacde4f0da4f42a2ba384321aa44fd.flv
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] flv: source url=/live/3abacde4f0da4f42a2ba384321aa44fd, is_edge=0, source_id=/
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] create consumer, active=0, queue_size=0.00, jitter=10000000
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] set fd=13 TCP_NODELAY 0=>1
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] set fd=13, SO_SNDBUF=87040=>50000, buffer=100ms
[2021-12-22 03:03:41.362][Trace][1][wi61r06y] FLV /live/3abacde4f0da4f42a2ba384321aa44fd.flv, encoder=FLV, nodelay=1, mw_sleep=100ms, cache=0, msgs=128
[2021-12-22 03:03:41.633][Trace][1][75a9d1j9] RTMP client ip=113.110.227.10:44557, fd=14
[2021-12-22 03:03:41.684][Trace][1][75a9d1j9] simple handshake success.
[2021-12-22 03:03:41.684][Trace][1][75a9d1j9] connect app, tcUrl=rtmp://183.56.214.38:1935/liv, pageUrl=, swfUrl=, schema=rtmp, vhost=183.56.214.38, port=1935, app=liv, args=null
[2021-12-22 03:03:41.684][Trace][1][75a9d1j9] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2021-12-22 03:03:41.734][Trace][1][2k617qs4] Hybrid cpu=0.00%,13MB, cid=1,1, timer=63,0,0, clock=0,49,0,0,0,0,0,0,0, objs=(pkt:0,raw:0,fua:0,msg:1,oth:0,buf:0)
[2021-12-22 03:03:41.783][Trace][1][75a9d1j9] client identified, type=fmle-publish, vhost=183.56.214.38, app=liv, stream=3abacde4f0da4f42a2ba384321aa44fd, param=, duration=0ms
[2021-12-22 03:03:41.783][Trace][1][75a9d1j9] connected stream, tcUrl=rtmp://183.56.214.38:1935/liv, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=liv, stream=3abacde4f0da4f42a2ba384321aa44fd, param=, args=null
[2021-12-22 03:03:41.783][Trace][1][75a9d1j9] new source, stream_url=/liv/3abacde4f0da4f42a2ba384321aa44fd
[2021-12-22 03:03:41.783][Trace][1][75a9d1j9] source url=/liv/3abacde4f0da4f42a2ba384321aa44fd, ip=113.110.227.10, cache=0, is_edge=0, source_id=/
[2021-12-22 03:03:41.843][Trace][1][75a9d1j9] new source, stream_url=/liv/3abacde4f0da4f42a2ba384321aa44fd
[2021-12-22 03:03:41.843][Trace][1][75a9d1j9] RTC bridge from RTMP, rtmp2rtc=0, keep_bframe=0, merge_nalus=0
[2021-12-22 03:03:41.844][Trace][1][75a9d1j9] hls: win=60000ms, frag=10000ms, prefix=, path=./objs/nginx/html, m3u8=[app]/[stream].m3u8, ts=[app]/[stream]-[seq].ts, aof=2.00, floor=0, clean=1, waitk=1, dispose=0ms, dts_directly=1
[2021-12-22 03:03:41.844][Trace][1][75a9d1j9] ignore disabled exec for vhost=__defaultVhost__
[2021-12-22 03:03:41.844][Trace][1][75a9d1j9] http: mount flv stream for sid=/liv/3abacde4f0da4f42a2ba384321aa44fd, mount=/liv/3abacde4f0da4f42a2ba384321aa44fd.flv
[2021-12-22 03:03:41.844][Trace][1][75a9d1j9] set fd=14 TCP_NODELAY 0=>1
[2021-12-22 03:03:41.844][Trace][1][75a9d1j9] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=1
[2021-12-22 03:03:41.891][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
[2021-12-22 03:03:41.914][Trace][1][f6d110xn] HTTP #229 113.110.227.10:51232 GET http://183.56.214.38:1985/api/v1/summaries?callback=angular.callbacks._3d7, content-length=-1
[2021-12-22 03:03:41.930][Warn][1][75a9d1j9][11] VIDEO: stream not monotonically increase, please open mix_correct.
[2021-12-22 03:03:41.930][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
[2021-12-22 03:03:41.940][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
[2021-12-22 03:03:41.989][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
[2021-12-22 03:03:43.020][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
[2021-12-22 03:03:44.037][Trace][1][75a9d1j9] 31B video sh,  codec(7, profile=Main, level=3.1, 704x576, 0kbps, 0.0fps, 0.0s)
  1. SRS configuration:

Please ensure that the markdown structure is maintained.

# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
#srs_log_tank        file;
#srs_log_file        ./objs/srs.log;
daemon              on;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          7080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled on;
    listen 8000;
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    candidate $CANDIDATE;
}
vhost __defaultVhost__ {
    gop_cache       off;
    queue_length    10;
    min_latency     on;
    mr {
        enabled     off;
    }
    mw_latency      100;
    tcp_nodelay     on;

    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
        rtmp_to_rtc off;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
        rtc_to_rtmp off;
    }
}

Replay

Please ensure that the markdown structure is maintained.

How to replay bug?

Please ensure that the markdown structure is maintained.

How to replay bug?

  1. Start the SRS server.
  2. Start streaming with the following address: rtmp://18.5.21*.38:1935/live/3abacde4f0da4f42a2ba384321aa44fd.
  3. Unable to play the video through flvjs using the following URL: http://18*.5*.21*.38:7080/live/3abacde4f0da4f42a2ba384321aa44fd.flv.
  4. Change the flvjs playback URL to http://18*.5*.21*.38:7080/liv/3abacde4f0da4f42a2ba384321aa44fd.flv, and the video can be played normally. The "live" part in the URL has been changed to "liv".

Please ensure that the markdown structure is maintained.

Expected Behavior

Please describe what you expect to happen.

flvjs can play videos through a regular http-flv address: http://18*.5*.21*.38:7080/live/3abacde4f0da4f42a2ba384321aa44fd.flv

TRANS_BY_GPT3

chundonglinlin commented 2 years ago

Analyze the Log log and found that your operation is to first GET http://183.56.214.38:7080/live/3abacde4f0da4f42a2ba384321aa44fd.flv for playback, and then start streaming to the srs service. At this time, the log prints tcUrl=rtmp://183.56.214.38:1935/liv. I guess there might be an error in your streaming endpoint address. Is your streaming endpoint OBS, ffmpeg, or something else? Can the previous server still reproduce the issue? I followed your steps but couldn't reproduce this problem.

TRANS_BY_GPT3

dzxiang commented 2 years ago

Analyzing the Log file, it was found that your operation was to first play the file at http://183.56.214.38:7080/live/3abacde4f0da4f42a2ba384321aa44fd.flv using a GET request, and then start streaming to the SRS service. At this point, the log prints tcUrl=rtmp://183.56.214.38:1935/liv. It is speculated that there might be an error in the address of your streaming endpoint. Is your streaming endpoint OBS, ffmpeg, or something else? Can the issue be reproduced on the previous server? I followed your steps but couldn't reproduce this problem.

Thank you for your response. I used an open-source streaming tool library on the device side. I tried pushing the same address using OBS and FFMPEG, but couldn't reproduce the issue. It seems to be a bug in the streaming tool library on the streaming endpoint.

TRANS_BY_GPT3

winlinvip commented 2 years ago

Thank you @chundonglinlin 👍

TRANS_BY_GPT3