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

RTMP: Nginx-rtmp streaming to SRS failed for dropping AMF0 message. #958

Open
juntaoliu opened this issue Aug 18, 2017 · 5 comments
Open
Assignees
Labels
Discussion Discussion or questions. TransByAI Translated by AI/GPT. Won't fix We won't fix it.
Milestone

Comments

@juntaoliu
Copy link
Contributor

juntaoliu commented Aug 18, 2017

The origin server uses Nginx-rtmp to push the stream to SRS, but an error occurs and the video cannot be played. However, if SRS pulls the stream from Nginx-rtmp, there is no problem and it can be played.

SRS version related information:
server:SRS/2.0.243(ZhouGuowen)
server_version:2.0.243

Video related information:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.18.100
Duration: 00:09:56.50, start: 0.021333, bitrate: 598 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 464 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:

The following is the error log:

[2017-08-18 23:04:01.927][trace][5327][2198] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-18 23:04:01.927][trace][5327][2198] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-18 23:04:01.927][trace][5327][598] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-18 23:04:01.927][trace][5327][598] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-18 23:04:01.927][trace][5327][598] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-18 23:04:01.927][trace][5327][598] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-18 23:04:01.927][trace][5327][570] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-18 23:04:01.927][trace][5327][570] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-18 23:04:01.927][trace][5327][570] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-18 23:04:01.927][trace][5327][570] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-18 23:04:01.927][trace][5327][542] identify ignore messages except AMF0/AMF3 command message. type=0x8

TRANS_BY_GPT3

@juntaoliu
Copy link
Contributor Author

juntaoliu commented Aug 19, 2017

Other logs to add:

[2017-08-19 20:55:15.940][trace][2693][107] RTMP client ip=127.0.0.1
[2017-08-19 20:55:15.940][trace][2693][107] srand initialized the random.
[2017-08-19 20:55:15.969][trace][2693][107] complex handshake success
[2017-08-19 20:55:16.010][trace][2693][107] discovery hostname=CentOs6.6Dev
[2017-08-19 20:55:16.010][trace][2693][107] connect app, tcUrl=rtmp://127.0.0.1:1936/live, pageUrl=, swfUrl=, schema=rtmp, vhost=defaultVhost, port=1936, app=live, args=null
[2017-08-19 20:55:16.058][trace][2693][107] client identified, type=Flash-Publish, stream_name=gaoxiao, duration=-1.00
[2017-08-19 20:55:16.081][trace][2693][107] source url=/live/gaoxiao, ip=127.0.0.1, cache=1, is_edge=0, source_id=-1[-1]
[2017-08-19 20:55:16.093][trace][2693][107] http: mount flv stream for vhost=/live/gaoxiao, mount=/live/gaoxiao.flv
[2017-08-19 20:55:16.104][trace][2693][107] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0, rtcid=111
[2017-08-19 20:55:17.012][trace][2693][107] got metadata, width=544, height=720, vcodec=7, acodec=10
[2017-08-19 20:55:17.012][trace][2693][107] protocol in.buffer=0, in.ack=5000000, out.ack=2500000, in.chunk=4096, out.chunk=60000
[2017-08-19 20:55:17.012][trace][2693][107] 44B video sh, codec(7, profile=High, level=3, 544x720, 0kbps, 0fps, 0s)
[2017-08-19 20:55:17.012][trace][2693][107] 4B audio sh, codec(10, profile=LC, 1channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
[2017-08-19 20:55:17.012][trace][2693][107] 44B video sh, codec(7, profile=High, level=3, 544x720, 0kbps, 0fps, 0s)
[2017-08-19 20:55:17.012][trace][2693][107] 4B audio sh, codec(10, profile=LC, 1channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
[2017-08-19 20:55:17.012][trace][2693][107] flash flash publish finished.
[2017-08-19 20:55:17.013][trace][2693][107] cleanup when unpublish
[2017-08-19 20:55:17.013][trace][2693][107] control message(unpublish) accept, retry stream service.
[2017-08-19 20:55:17.013][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-19 20:55:17.013][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-19 20:55:17.013][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-19 20:55:17.013][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x9
[2017-08-19 20:55:17.022][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x8
[2017-08-19 20:55:17.022][trace][2693][107] identify ignore messages except AMF0/AMF3 command message. type=0x8

TRANS_BY_GPT3

@juntaoliu
Copy link
Contributor Author

juntaoliu commented Aug 19, 2017

Summary of the following four usage scenarios, recorded here:

  1. ffmpge pushes the stream to SRS, and SRS directly forwards it to Nginx-Rtmp. Both sides can play without any issues.
  2. ffmpge pushes the stream to Nginx-Rtmp, and SRS specifies the edge mode. It pulls the stream from Nginx-Rtmp by specifying the origin as Nginx-Rtmp. Both sides can play without any issues.
  3. ffmpge pushes the stream to SRS, and Nginx-Rtmp uses the pull command to specify SRS as the source for pulling the stream. It cannot play the stream (but SRS can play it).
  4. ffmpge pushes the stream to Nginx-Rtmp, and Nginx-Rtmp uses the push command to push it to SRS. Nginx-Rtmp fails to forward the stream (but Nginx-Rtmp can play it).

TRANS_BY_GPT3

@juntaoliu
Copy link
Contributor Author

juntaoliu commented Aug 22, 2017

The aforementioned issues, two of which cannot be played, have been identified with approximate reasons.

Regarding the aforementioned issue 3, the reason is that nginx-rtmp is configured with the option "idle_streams on," which causes the origin request to fail when nginx-rtmp is used as an edge server. This option should not be used in this scenario.

As for the aforementioned issue 4, the reason is that the user added first frame caching in nginx-rtmp (added by the user themselves), which caused compatibility issues.

There is no problem with SRS and nginx-rtmp pushing and pulling streams from each other.

TRANS_BY_GPT3

@juntaoliu
Copy link
Contributor Author

juntaoliu commented Aug 24, 2017

When pushing the stream from nginx-rtmp to srs, the flash publish mode is used. This mode works fine in version 3.0 but has issues in version 2.0.

Commenting out the "return ERROR_CONTROL_REPUBLISH;" in the following code can make it compatible.

int SrsRtmpConn::handle_publish_message(SrsSource* source, SrsCommonMessage* msg, bool is_fmle, bool vhost_is_edge)
{
    int ret = ERROR_SUCCESS;

    // process publish event.
    if (msg->header.is_amf0_command() || msg->header.is_amf3_command()) {
        SrsPacket* pkt = NULL;
        if ((ret = rtmp->decode_message(msg, &pkt)) != ERROR_SUCCESS) {
            srs_error("fmle decode unpublish message failed. ret=%d", ret);
            return ret;
        }
        SrsAutoFree(SrsPacket, pkt);

        // for flash, any packet is republish.
        if (!is_fmle) {
            // flash unpublish.
            // TODO: maybe need to support republish.
            srs_trace("flash flash publish finished.");
            //return ERROR_CONTROL_REPUBLISH;
        }

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 13, 2021
@winlinvip winlinvip added Discussion Discussion or questions. Won't fix We won't fix it. labels Sep 13, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 13, 2021
@winlinvip winlinvip changed the title Nginx-rtmp推流到srs出问题 Nginx-rtmp streaming to SRS has a problem. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
@winlinvip winlinvip changed the title Nginx-rtmp streaming to SRS has a problem. Nginx-rtmp streaming to SRS failed for dropping AMF0 message. Apr 6, 2024
@winlinvip
Copy link
Member

Reopen this issue for it may exists in 5.0, see #3620

@winlinvip winlinvip reopened this Apr 6, 2024
@winlinvip winlinvip changed the title Nginx-rtmp streaming to SRS failed for dropping AMF0 message. RTMP: Nginx-rtmp streaming to SRS failed for dropping AMF0 message. Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Discussion or questions. TransByAI Translated by AI/GPT. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

2 participants