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

srs-5.0.12 uses Hikvision camera GB28181 for normal RTMP playback, but cannot play WebRTC. #2642

Closed
kirofreedom opened this issue Sep 29, 2021 · 10 comments
Assignees
Labels
Discussion Discussion or questions. GB28181 For GB28181. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Milestone

Comments

@kirofreedom
Copy link

kirofreedom commented Sep 29, 2021

Note: Issues that do not provide the following information will be directly deleted (Please follow the issue template, or we will delete it)
'
Make sure to maintain the markdown structure.

Note: For inquiries and discussions, please submit them to the SRS community (Please ask questions at) http://bbs.ossrs.net
'
Make sure to maintain the markdown structure.

Description

Please describe your issue here.

  1. SRS version: 5.0.12 (feature/gb28181 branch)
  1. The log of SRS is as follows:
[2021-09-29 18:10:36.005][Warn][128032][39r5083u][11] RTC error code=5018 : create session, dtls=1, srtp=1, eip= : create session : add player : play negotiate : no valid found h264 payload type
thread [128032][39r5083u]: do_serve_http() [src/app/srs_app_rtc_api.cpp:191][errno=11]
thread [128032][39r5083u]: create_session() [src/app/srs_app_rtc_server.cpp:480][errno=11]
thread [128032][39r5083u]: do_create_session() [src/app/srs_app_rtc_server.cpp:501][errno=11]
thread [128032][39r5083u]: add_player() [src/app/srs_app_rtc_conn.cpp:2020][errno=11]
thread [128032][39r5083u]: negotiate_play_capability() [src/app/srs_app_rtc_conn.cpp:3196][errno=11]
[2021-09-29 18:10:36.047][Trace][128032][39r5083u] TCP: before dispose resource(HttpConn)(0x22ed690), conns=4, zombies=0, ign=0, inz=0, ind=0
[2021-09-29 18:10:36.047][Warn][128032][39r5083u][104] client disconnect peer. ret=1007
[2021-09-29 18:10:36.047][Trace][128032][0py0r282] TCP: clear zombies=1 resources, conns=4, removing=0, unsubs=0
[2021-09-29 18:10:36.047][Trace][128032][39r5083u] TCP: disposing #0 resource(HttpConn)(0x22ed690), conns=4, disposing=1, zombies=0
[2021-09-29 18:10:36.787][Trace][128032][0x84e94z] gb28181: client id=34020000001320000001@34020000001320000001,  ssrc=0x8ac009, peer(192.168.2.14, 15060), rtmp muxer is alive
  1. The configuration of SRS is as follows:
# 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;

>    # 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 receiving device side
    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
    # It will also encapsulate the ADTS header in the FLV AAC raw data
    # This way, the player will 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;

>    # Whether to enable RTP buffering
    # Enabling it can effectively solve issues like RTP out-of-order
    # It is recommended to disable it for TCP mode.
    jitterbuffer_enable  off;

>    # Server host, can be a domain name or IP address
    # This is the address to which the device sends media. If the server is on an internal or external network,
    # the external address needs to be specified.
    # The IP address returned by the API when creating a stream session is also the host.
    # $CANDIDATE is a system environment variable used to obtain the address from the environment variables.
    # If it is not configured, "*" is used to specify the network card address for stats network.
    # If the network is not configured, the default is the address of the 0th network card.
    # TODO: https://github.com/ossrs/srs/pull/1679/files#r400917594
    # host       $CANDIDATE;
    host       192.168.2.200;
>    # Create an RTMP media channel based on the received PS RTP packets, no need to create it through the API interface.
    # The RTMP address parameter [stream] is the channel ID in the format chid[ssrc].
    auto_create_channel   off;

    sip {
>        # Whether to enable internal SIP signaling in SRS.
        # Use "on" to route signaling through SRS, and "off" to only forward PS streams.
        enabled on;
        
>        # UDP port for SIP listening.
        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),
        # the device is considered offline.
        keepalive_timeout   120;

>        # Whether to automatically send an invite to the device after registration
        # on: yes  off: no, needs to be controlled through 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;
    candidate       192.168.2.200;
}

vhost __defaultVhost__ {
    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?

  1. Start the Hikvision camera (gb28181).
  2. Run the srs_gb28181.html webpage.
  3. Select "GB28181" and query the GB28181 media channel.
  4. After selecting an existing channel, click on "RTC Play". An error occurs, but playing RTMP stream using VLC works fine.

Expected behavior

The expectation is to be able to play WebRTC streams normally.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Sep 29, 2021

This error is very clear: no valid found h264 payload type.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 29, 2021
@winlinvip winlinvip added GB28181 For GB28181. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. labels Sep 29, 2021
@winlinvip winlinvip added this to the 5.0 milestone Sep 29, 2021
@kirofreedom
Copy link
Author

kirofreedom commented Sep 30, 2021

Hmm, the backend display shows that there is a stream, and rtmp can play normally. The camera uses h264 encoding. I am currently testing with srs. I am just starting to work on audio and video, and I am still a beginner. I appreciate the help from all the experts.

TRANS_BY_GPT3

@qichaoshen82
Copy link

qichaoshen82 commented Nov 17, 2021

Suggest using the latest gb28181 branch code and adding the "rtmp_to_rtc on;" field in the configuration file.

If there are still issues after using the latest code and adding "rtmp_to_rtc on;", you can reopen the issue. This issue can be closed as per the suggestion.
@duiniuluantanqin @winlinvip

TRANS_BY_GPT3

@tifcty1
Copy link

tifcty1 commented Dec 8, 2021

The latest version of GB seems to indeed have issues with RTC playback, unlike previous versions like 5.0.12. Enabling 'rtmp_to_rtc on' resolves the issue, but it is unclear whether it is a bug or not.

It is recommended to use the latest gb28181 branch code and add the 'rtmp_to_rtc on' field in the configuration file.

If there are still issues after using the latest code and adding "rtmp_to_rtc on;", you can reopen the issue. This issue is recommended to be closed. @duiniuluantanqin @winlinvip

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

duiniuluantanqin commented Dec 8, 2021

Previously, rtmp_to_rtc was enabled by default, but now it is off by default. This is not a bug.

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

@tifcty1
Copy link

tifcty1 commented Dec 9, 2021

So that's how it is, thank you 🙏

TRANS_BY_GPT3

@kirofreedom
Copy link
Author

kirofreedom commented Dec 10, 2021

It is recommended to use the latest gb28181 branch code and add the "rtmp_to_rtc on;" field in the configuration file.

If there are still issues after using the latest code and adding "rtmp_to_rtc on;", you can reopen the issue. This issue is suggested to be closed. @duiniuluantanqin @winlinvip

Thank you very much!! I will give it a try.

TRANS_BY_GPT3

@hhw3KevinHou
Copy link

hhw3KevinHou commented Dec 22, 2021

rtmp_to_rtc on;

Good job, I have been working on it for more than a day. I searched through numerous online articles but couldn't find a reliable answer. Only here did I find the solution. I love you so much.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 23, 2021

Here, #2716 (comment), it explains in detail why it is set to default off. Originally, default on would be more convenient, but there were too many issues, so it had to be changed to off.

If you have any issues, please search in the official repository. The information found online is mostly copied and may not be up to date.

Then I will close this issue. Thank you all.

TRANS_BY_GPT3

@winlinvip winlinvip added Discussion Discussion or questions. Won't fix We won't fix it. labels Dec 23, 2021
@winlinvip winlinvip changed the title srs-5.0.12 使用海康摄像头GB28181 rtmp正常播放但webrtc无法播放 srs-5.0.12 uses Hikvision camera GB28181 for normal RTMP playback, but cannot play WebRTC. 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
Discussion Discussion or questions. GB28181 For GB28181. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

6 participants