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

海康gb28181 有流,但是无法用vlc播放 #2841 #6

Open
winlinvip opened this issue Jan 5, 2022 · 1 comment
Open

海康gb28181 有流,但是无法用vlc播放 #2841 #6

winlinvip opened this issue Jan 5, 2022 · 1 comment
Assignees

Comments

@winlinvip
Copy link
Member

注意:提问前,请先看FAQ(Please read FAQ before file an issue) ossrs/srs#2716

描述(Description)

描述你遇到了什么问题(Please description your issue here)
海康摄像头显示有流,但是无法在vlc播放

  1. SRS版本(Version): xxxxxx
    5.0.19

  2. SRS的日志如下(Log):
    [2022-01-04 15:03:21.045][Trace][10214][1278j137] gb28181: 34020000001110000001 client not registered
    [2022-01-04 15:03:21.527][Trace][10214][1278j137] gb28181: request client id=34020000001110000001 peer(39.82.235.105, 5060)
    [2022-01-04 15:03:21.527][Trace][10214][1278j137] gb28181: request method=REGISTER, uri=sip:34020000002000000001@3402000000, version=SIP/2.0 expires=86400
    [2022-01-04 15:03:23.528][Trace][10214][g49hbc2e] gb28181: sip session=34020000001110000001 peer(39.82.235.105, 5060) status(RegisterOk,AliveOk) duration(1,0)
    [2022-01-04 15:03:24.528][Trace][10214][g49hbc2e] gb28181: generate ssrc id=34020000001110000001@34020000001320000001, ssrc=38732042
    [2022-01-04 15:03:24.529][Trace][10214][g49hbc2e] new source, stream_url=/live/34020000001110000001@34020000001320000001
    [2022-01-04 15:03:24.529][Trace][10214][g49hbc2e] new source, stream_url=/live/34020000001110000001@34020000001320000001
    [2022-01-04 15:03:24.529][Trace][10214][g49hbc2e] RTC bridge from RTMP, rtmp2rtc=0, keep_bframe=0, merge_nalus=0
    [2022-01-04 15:03:24.529][Trace][10214][g49hbc2e] ignore disabled exec for vhost=
    [2022-01-04 15:03:24.529][Trace][10214][g49hbc2e] gb28181: create new stream channel id:34020000001110000001@34020000001320000001 rtmp url=rtmp://127.0.0.1:1935/live/34020000001110000001@34020000001320000001
    [2022-01-04 15:03:24.551][Trace][10214][1278j137] gb28181: ssrc in y line is 38732042:24f010a
    [2022-01-04 15:03:24.551][Trace][10214][1278j137] gb28181: request client id=34020000001320000001, peer(39.82.235.105, 5060)
    [2022-01-04 15:03:24.551][Trace][10214][1278j137] gb28181: respone method=INVITE, uri=34020000002000000001@3402000000, version=SIP/2.0
    [2022-01-04 15:03:24.551][Trace][10214][1278j137] gb28181: INVITE response 34020000001320000001 client status=200
    [2022-01-04 15:03:24.551][Trace][10214][1278j137] gb28181: device unique id is 34020000001110000001@34020000001320000001
    [2022-01-04 15:03:24.590][Trace][10214][x451c824] gb28181 new connect by rtp-tcp from: 39.82.235.105:34134
    [2022-01-04 15:03:24.646][Trace][10214][x451c824] <- GBS gb28181: client_id , peer(39.82.235.105, 34134) ps rtp packet 896B, age=139987034, vt=2/96, sts=0/3600/0x24f010a, paylod=884B
    [2022-01-04 15:03:24.646][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34183216
    [2022-01-04 15:03:24.675][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,14MB, cid=1,0, timer=63,0,0, clock=0,49,0,0,0,0,0,0,0
    [2022-01-04 15:03:24.696][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34214144
    [2022-01-04 15:03:24.746][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34245104
    [2022-01-04 15:03:24.766][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34275120
    [2022-01-04 15:03:24.846][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34305136
    [2022-01-04 15:03:24.867][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34335152
    [2022-01-04 15:03:24.896][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34365168
    [2022-01-04 15:03:24.946][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34395184
    [2022-01-04 15:03:24.965][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34426176
    [2022-01-04 15:03:25.046][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34456192
    [2022-01-04 15:03:25.066][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34486208
    [2022-01-04 15:03:25.096][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34516224
    [2022-01-04 15:03:25.147][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34546240
    [2022-01-04 15:03:25.166][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34576256
    [2022-01-04 15:03:25.246][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34606272
    [2022-01-04 15:03:25.260][Trace][10214][9s23rnds] RTP: jitbuffer key=34020000001110000001@34020000001320000001 reallocate a frame buffer size(884>0) resize(30884)
    [2022-01-04 15:03:25.529][Trace][10214][g49hbc2e] gb28181: 34020000001110000001 clients device=34020000001320000001 send invite code=0
    [2022-01-04 15:03:25.616][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34668144
    [2022-01-04 15:03:26.968][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34486208, _buffer:34699680
    [2022-01-04 15:03:26.991][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34699680, _buffer:-761106416
    [2022-01-04 15:03:27.577][Trace][10214][9s23rnds] RTP: jitbuffer key=34020000001110000001@34020000001320000001 reallocate a frame buffer size(201688>30884) resize(231688)
    [2022-01-04 15:03:27.577][Trace][10214][9s23rnds] gb28181: ps map video es_type=h264(1b), es_id=e0, es_info_length=28
    [2022-01-04 15:03:27.577][Trace][10214][9s23rnds] gb28181: ps map audio es_type=g711ulaw(91), es_id=c0, es_info_length=12
    [2022-01-04 15:03:29.374][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:30000, prevBuffer:0, _buffer:34636288
    [2022-01-04 15:03:29.676][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,15MB, cid=1,0, timer=63,0,0, clock=0,49,0,0,0,0,0,0,0
    [2022-01-04 15:03:30.958][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34516224, _buffer:34698832
    [2022-01-04 15:03:30.964][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34698832, _buffer:34788848
    [2022-01-04 15:03:31.058][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34606272, _buffer:34698832
    [2022-01-04 15:03:31.106][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34698832, _buffer:34998864
    [2022-01-04 15:03:31.217][Trace][10214][1278j137] sip: Notify cmdtype=Alarm not processed
    [2022-01-04 15:03:34.656][Trace][10214][x451c824] <- GBS gb28181: client_id , peer(39.82.235.105, 34134) ps rtp packet 1328B, age=149992944, vt=2/96, sts=673/903600/0x24f010a, paylod=1316B
    [2022-01-04 15:03:34.676][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,16MB, cid=3,1, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:03:35.108][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34546240, _buffer:34698160
    [2022-01-04 15:03:35.114][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34698160, _buffer:35208880
    [2022-01-04 15:03:39.125][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:420000, prevBuffer:-761106416, _buffer:35418896
    [2022-01-04 15:03:39.677][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,16MB, cid=3,1, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:03:43.109][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34668144, _buffer:34486208
    [2022-01-04 15:03:43.114][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:35838912
    [2022-01-04 15:03:43.124][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:420000, prevBuffer:35838912, _buffer:-761761776
    [2022-01-04 15:03:44.653][Trace][10214][9s23rnds] gb28181: client id=34020000001110000001@34020000001320000001, ssrc=0x24f010a, peer(39.82.235.105, 34134), rtmp muxer is alive
    [2022-01-04 15:03:44.678][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,16MB, cid=3,1, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:03:47.108][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34636288, _buffer:34486208
    [2022-01-04 15:03:47.115][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:35838912
    [2022-01-04 15:03:47.125][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:420000, prevBuffer:35838912, _buffer:-762183664
    [2022-01-04 15:03:49.678][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,17MB, cid=1,0, timer=62,0,0, clock=0,46,1,0,0,0,0,0,0
    [2022-01-04 15:03:51.109][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34365168, _buffer:34606272
    [2022-01-04 15:03:51.114][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34606272, _buffer:35838912
    [2022-01-04 15:03:51.125][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:420000, prevBuffer:35838912, _buffer:-762605552
    [2022-01-04 15:03:54.657][Trace][10214][x451c824] <- GBS gb28181: client_id , peer(39.82.235.105, 34134) ps rtp packet 16B, age=169984068, vt=2/96, sts=2289/2703600/0x24f010a, paylod=4B
    [2022-01-04 15:03:54.678][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,17MB, cid=1,0, timer=62,0,0, clock=0,46,1,0,0,0,0,0,0
    [2022-01-04 15:03:55.108][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34305136, _buffer:34606272
    [2022-01-04 15:03:55.114][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34606272, _buffer:35838912
    [2022-01-04 15:03:55.126][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:420000, prevBuffer:35838912, _buffer:-763027440
    [2022-01-04 15:03:59.058][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34245104, _buffer:34486208
    [2022-01-04 15:03:59.064][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:35838912
    [2022-01-04 15:03:59.679][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,17MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:03.058][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34183216, _buffer:34486208
    [2022-01-04 15:04:03.064][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:36048928
    [2022-01-04 15:04:04.657][Trace][10214][x451c824] <- GBS gb28181: client_id , peer(39.82.235.105, 34134) ps rtp packet 512B, age=179991823, vt=2/96, sts=3009/3603600/0x24f010a, paylod=500B
    [2022-01-04 15:04:04.679][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:07.109][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34576256, _buffer:34486208
    [2022-01-04 15:04:07.115][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:34576224
    [2022-01-04 15:04:09.679][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:14.674][Trace][10214][9s23rnds] gb28181: client id=34020000001110000001@34020000001320000001, ssrc=0x24f010a, peer(39.82.235.105, 34134), rtmp muxer is alive
    [2022-01-04 15:04:14.680][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:15.058][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34456192, _buffer:34486208
    [2022-01-04 15:04:15.065][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34486208, _buffer:36258944
    [2022-01-04 15:04:19.058][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34426176, _buffer:34456192
    [2022-01-04 15:04:19.065][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34456192, _buffer:36468960
    [2022-01-04 15:04:19.680][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:23.059][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34395184, _buffer:34425936
    [2022-01-04 15:04:23.065][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34425936, _buffer:36678976
    [2022-01-04 15:04:23.566][Trace][10214][g49hbc2e] gb28181: sip session=34020000001110000001 peer(39.82.235.105, 5060) status(RegisterOk,AliveOk) duration(62,3)
    [2022-01-04 15:04:24.680][Trace][10214][d3p3ue8j] Hybrid cpu=0.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:24.694][Trace][10214][9s23rnds] gb28181: client id=34020000001110000001@34020000001320000001, ssrc=0x24f010a, peer(39.82.235.105, 34134), rtmp muxer is alive
    [2022-01-04 15:04:27.059][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34335152, _buffer:34425936
    [2022-01-04 15:04:27.065][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34425936, _buffer:36888992
    [2022-01-04 15:04:29.681][Trace][10214][d3p3ue8j] Hybrid cpu=1.00%,18MB, cid=1,0, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0
    [2022-01-04 15:04:31.059][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:90000, prevBuffer:34275120, _buffer:34425936
    [2022-01-04 15:04:31.065][Trace][10214][x451c824] RTP: jitbuffer VerifyAndAllocate:newSize:210000, prevBuffer:34425936, _buffer:37099008

  3. SRS的配置如下(Config):
    `# push gb28181 stream to SRS.

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

http_api {
enabled on;
listen 1985;
}

http_server {
enabled on;
listen 8080;
}

stats {
network 0;
}

stream_caster {
enabled on;
caster gb28181;

# 转发流到rtmp服务器地址与端口
# TODO: https://github.com/ossrs/srs/pull/1679/files#r400875104
# [stream] is VideoChannelCodecID(视频通道编码ID) for sip
# 自动创建的道通[stream] 是‘chid[ssrc]’ [ssrc]是rtp的ssrc
# [ssrc] rtp中的ssrc
output              rtmp://127.0.0.1:1935/live/[stream];

# 接收设备端rtp流的多路复用端口
listen              9000;
# 多路复用端口类型,on为tcp,off为udp
# 默认:on
tcp_enable            on;

# rtp接收监听端口范围,最小值
rtp_port_min        58200;
# rtp接收监听端口范围,最大值
rtp_port_max        58300;

是否等待关键帧之后,再转发,

# off:不需等待,直接转发
# on:等第一个关键帧后,再转发
wait_keyframe       on;

# rtp包空闲等待时间,如果指定时间没有收到任何包
# rtp监听连接自动停止,发送BYE命令
rtp_idle_timeout    30;

# 是否转发音频流
# 目前只支持aac格式,所以需要设备支持aac格式
# on:转发音频
# off:不转发音频,只有视频
# *注意*!!!:flv 只支持11025  22050  44100 三种
# 如果设备端没有三种中任何一个,转发时为自动选择一种格式
# 同时也会将adts的头封装在flv aac raw数据中
# 这样的话播放器为自动通过adts头自动选择采样频率
# 像ffplay, vlc都可以,但是flash是没有声音,
# 因为flash,只支持11025 22050 44100
audio_enable        off;


# 服务器主机号,可以域名或ip地址
# 也就是设备端将媒体发送的地址,如果是服务器是内外网
# 需要写外网地址,
# 调用api创建stream session时返回ip地址也是host
# $CANDIDATE 是系统环境变量,从环境变量获取地址,如果没有配置,用*
# *代表指定stats network 的网卡号地址,如果没有配置network,默认则是第0号网卡地址
# TODO: https://github.com/ossrs/srs/pull/1679/files#r400917594
host       124.223.16.146;

#根据收到ps rtp包自带创建rtmp媒体通道,不需要api接口创建
#rtmp地址参数[stream] 就是通道id  格式chid[ssrc]
auto_create_channel   off;

sip {
    # 是否启用srs内部sip信令
    # 为on信令走srs, off 只转发ps流
    enabled on;

    # sip监听udp端口
    listen              5060;

    # SIP server ID(SIP服务器ID).
    # 设备端配置编号需要与该值一致,否则无法注册
    serial              34020000002000000001;

    # SIP server domain(SIP服务器域)
    realm               3402000000;

    # 服务端发送ack后,接收回应的超时时间,单位为秒
    # 如果指定时间没有回应,认为失败
    ack_timeout         30;

    # 设备心跳维持时间,如果指定时间内(秒)没有接收一个心跳
    # 认为设备离线
    keepalive_timeout   120;

    # 注册之后是否自动给设备端发送invite
    # on: 是  off 不是,需要通过api控制
    auto_play           on;
    # 设备将流发送的端口,是否固定
    # on 发送流到多路复用端口 如9000
    # off 自动从rtp_mix_port - rtp_max_port 之间的值中
    # 选一个可以用的端口
    invite_port_fixed     on;

    # 向设备或下级域查询设备列表的间隔,单位(秒)
    # 默认60秒
    query_catalog_interval  60;
}

}

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 ossrs/srs#307 (comment)
candidate $CANDIDATE;
}

vhost defaultVhost {
rtc {
enabled on;
bframe discard;
}

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

} `
1641280660405

重现(Replay)

重现Bug的步骤(How to replay bug?)

按照上述配置情况

期望行为(Expect)

描述你期望发生的事情(Please describe your expectation)

@winlinvip
Copy link
Member Author

Migrate to ossrs/srs#2841

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants