GB28181: Internal network is normal, external network mapping is abnormal, using FFmpeg is normal #2773
Closed
Description
Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) #2716
Description
Please describe the issue you encountered:
GB28181: It works fine when using the internal network, and I can register and control the camera using the external network. However, I am unable to view the video. Additionally, the channels are initially available but disappear after a while.
-
SRS Version:
feature/gb28181
-
The SRS log is as follows:
[2021-12-62 15:52:18.584][Trace][1117][4s55gi4] gb28181: client id-34020Q00132001634200Q131001, strem idle timeout , stop![2021-12-0215:52:88.584][Trace][1117][595gk4] gb28181: client id=-34020008132000016340200013100001 rtup muxer is remove
[2021-12-02 15:52:08.584][Trace][21117][qs595gk4] client finished.
[2021-12-02 15:52:08.584][Trace][21117][5577i380] cleanup when unpublish
- The SRS configuration is as follows:
Note: The CANDIDATE configuration file has been replaced with the external network address.
# push gb28181 stream to SRS.
# push gb28181 stream to SRS.
listen 1935;
max_connections 1000;
daemon on;
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;
# Forward the stream to the rtmp server address and port.
# TODO: https://github.com/ossrs/srs/pull/1679/files#r400875104
# [stream] is the VideoChannelCodecID for sip
# The automatically created channel [stream] is 'chid[ssrc]', where [ssrc] is the rtp ssrc
# [ssrc] is the ssrc in rtp
output rtmp://127.0.0.1:1935/live/[stream];
# Multiplexing port for receiving rtp streams from the device end
listen 9000;
# Multiplexing port type, on for TCP, off for UDP
# Default: on
tcp_enable on;
# Range of RTP receiving listening ports, minimum value
rtp_port_min 58200;
# Range of RTP receiving listening ports, maximum value
rtp_port_max 58300;
# Whether to wait for a keyframe before forwarding,
# off: No need to wait, forward directly
# on: Wait for the first keyframe before forwarding
wait_keyframe on;
# Idle waiting time for RTP packets, if no packets are received within the specified time
# the RTP listening connection will automatically stop and send a BYE command.
rtp_idle_timeout 30;
# Whether to forward the audio stream
# Currently only supports AAC format, so the device needs to support AAC format
# on: forward audio
# off: do not forward audio, only video
# *Note*!!!: flv only supports three sample rates: 11025, 22050, 44100
# If the device does not support any of these three, it will automatically select one format during forwarding
# At the same time, the ADTS header will be encapsulated in the FLV AAC raw data
# This allows the player to automatically select the sampling frequency based on the ADTS header
# Players like ffplay and vlc can do this, but flash does not have sound
# because flash only supports 11025, 22050, 44100.
audio_enable off;
# Server host number, can be a domain name or IP address
# This is the address to which the device sends the media. If the server is on an internal or external network,
# the external network address needs to be specified.
# When calling the API to create a stream session, the returned IP address is also the host.
# $CANDIDATE is a system environment variable that retrieves the address from the environment variable. If it is not configured, use *
# * represents the address of the network card specified by stats network. If network is not configured, the default is the address of network card 0.
# TODO: https://github.com/ossrs/srs/pull/1679/files#r400917594
host $CANDIDATE;
# Create an RTMP media channel based on the received PS RTP packets, no need to create an API interface
# The RTMP address parameter [stream] is the channel ID in the format chid[ssrc]
auto_create_channel off;
sip {
# Enable internal SIP signaling in SRS
# Set to 'on' to use SRS for signaling, 'off' to only forward PS streams
enabled on;
# SIP listening UDP port
listen 5060;
# SIP server ID.
# The device configuration number needs to be consistent with this value, otherwise registration will fail.
serial 34020000002000000001;
# SIP server domain.
realm 3402000000;
# Timeout for receiving response after sending ACK from the server, in seconds.
# If no response is received within the specified time, it is considered a failure.
ack_timeout 30;
# Device heartbeat maintenance time, if no heartbeat is received within the specified time (in seconds),
# it is considered that the device is offline.
keepalive_timeout 120;
# Whether to automatically send an invite to the device after registration
# on: yes off: no, it needs to be controlled through the API.
auto_play on;
# Whether the port for sending streams from the device is fixed
# on: send streams to a multiplexing port like 9000
# off: automatically select a port from the range between rtp_mix_port and rtp_max_port that is available.
invite_port_fixed on;
# Interval for querying the device list from the device or subdomain, in seconds
# Default is 60 seconds
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 https://github.com/ossrs/srs/issues/307#issuecomment-599028124
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
rtc {
enabled on;
bframe discard;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
Replay
How to replay bug?
Steps to reproduce the bug
How to replay bug?
- Register the camera to gb28181.
- After the camera is registered, the channel can be seen. Click on the preview image, but there is no image. The camera can still be controlled.
Note: If it is an internal network, it is appropriate.
Expected behavior (Expect)
Describe your expectation:
- Analyze possible reasons.
- See if we can resolve this issue.
Please make sure to maintain the markdown structure.
TRANS_BY_GPT3