ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The first time I pulled the stream, there was only sound, and there was no image. When I initiated the second stream pull, I was able to see both the image and hear the sound normally.

jiangzhibin opened this issue · comments

Streaming device A is streaming to the server. Viewing device B initiates the first pull stream from the server. There is a certain probability of encountering "avc ignore type=1 for no sequence header. ret=0" and then there is sound but no image. After encountering the above situation, switch to device C for pulling the stream. Device C is able to display the video and image correctly, while device B still has no image, only sound. The following is the log before enabling mix_correct (after enabling mix_correct, "avc ignore type=1 for no sequence header" keeps appearing).

[2016-11-29 13:36:28.608][trace][21669][965] simple handshake success.
[2016-11-29 13:36:28.609][trace][21669][965] connect app, tcUrl=rtmp://anfang.263nt.com/6099379B-D4C9-4C3E-B64C-90898809796A?deviceId=10001&accessToken=9E5D35420FE74B1CBC0EAF6F5019D5FB, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=6099379B-D4C9-4C3E-B64C-90898809796A, args=null
[2016-11-29 13:36:28.609][trace][21669][965] out chunk size to 60000
[2016-11-29 13:36:28.673][trace][21669][965] client identified, type=fmle-publish, stream_name=live, duration=-1.00
[2016-11-29 13:36:28.694][trace][21669][965] source url=/6099379B-D4C9-4C3E-B64C-90898809796A/live, ip=211.157.227.77, cache=1, is_edge=0, source_id=-1[-1]
[2016-11-29 13:36:28.743][trace][21669][965] hls: win=4.00, frag=1.00, prefix=, path=./objs/nginx/html, m3u8=[app]/[stream].m3u8, ts=[app]/[stream]-[seq].ts, aof=2.00, floor=0, clean=1, waitk=1, dispose=0
[2016-11-29 13:36:28.753][trace][21669][965] start publish mr=0/350, p1stpt=20000, pnt=20000, tcp_nodelay=0, rtcid=968
[2016-11-29 13:36:28.814][trace][21669][970] RTMP client ip=211.157.226.130
[2016-11-29 13:36:28.829][trace][21669][965] 4B audio sh, codec(10, profile=LC, 1channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
[2016-11-29 13:36:28.829][trace][21669][970] complex handshake success
[2016-11-29 13:36:28.833][trace][21669][970] connect app, tcUrl=rtmp://anfang.263nt.com:1935/6099379B-D4C9-4C3E-B64C-90898809796A, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=6099379B-D4C9-4C3E-B64C-90898809796A, args=null
[2016-11-29 13:36:28.833][trace][21669][970] out chunk size to 60000
[2016-11-29 13:36:28.885][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:28.885][trace][21669][970] ignore AMF0/AMF3 command message.
[2016-11-29 13:36:28.890][trace][21669][970] ignore AMF0/AMF3 command message.
[2016-11-29 13:36:28.933][trace][21669][970] client identified, type=Play, stream_name=live, duration=-1.00
[2016-11-29 13:36:28.933][trace][21669][970] source url=/6099379B-D4C9-4C3E-B64C-90898809796A/live, ip=211.157.226.130, cache=1, is_edge=0, source_id=965[965]
[2016-11-29 13:36:28.933][trace][21669][970] dispatch cached gop success. count=3, duration=50
[2016-11-29 13:36:28.933][trace][21669][970] create consumer, queue_size=30.00, jitter=1
[2016-11-29 13:36:28.943][trace][21669][970] mw changed sleep 350=>350, max_msgs=128, esbuf=218750, sbuf 87040=>218750, realtime=0
[2016-11-29 13:36:28.943][trace][21669][970] start play smi=0.00, mw_sleep=350, mw_enabled=1, realtime=0, tcp_nodelay=0
[2016-11-29 13:36:28.943][trace][21669][971] ignored. set buffer length to 3000
[2016-11-29 13:36:28.949][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.043][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.112][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.139][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.221][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.280][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.397][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.440][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.489][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.501][trace][21669][738] 43B video sh,  codec(7, profile=Baseline, level=Other, 640x480, 0kbps, 0fps, 0s)
[2016-11-29 13:36:29.599][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.646][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.699][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.768][warn][21669][965][11] avc ignore type=1 for no sequence header. ret=0
[2016-11-29 13:36:29.797][trace][21669][965] 43B video sh,  codec(7, profile=Baseline, level=Other, 640x480, 0kbps, 0fps, 0s)
[2016-11-29 13:36:29.904][warn][21669][965][11] VIDEO: stream not monotonically increase, please open mix_correct.

TRANS_BY_GPT3

#408 Is this what caused it?

TRANS_BY_GPT3

The first time there was no image during the streaming, but subsequent streaming attempts were normal. This problem occurs frequently, not occasionally.

TRANS_BY_GPT3

For comparison, three streaming media tests were conducted using nginx-rtmp-module, Red5, and Adobe Media Server, all of which did not have the aforementioned issues.

TRANS_BY_GPT3

There is a detail, which is that during the first streaming, the time for pulling the stream is earlier than pushing the stream. In other words, pulling the stream happens first, and a few seconds later, pushing the stream will take place.

TRANS_BY_GPT3

Encountered the same problem. This is the test source:

ffmpeg -i rtmp://lssplay.iermu.com/iermu/58fed5be006abe6044e9d0ae1c1b9809 -c:a aac -ar 44100 -ab 48k -c:v libx264 -f flv rtmp:/localhost/live/test

TRANS_BY_GPT3

The root cause of this problem is that if the first data frame that comes in for streaming is not the sequence header (sps/pps), but IPB data frames, then the following issues will occur:

avc ignore type=1 for no sequence header. ret=0

At the same time, forwarding IPB frames to the client may cause the player to fail in decoding and result in a black screen.

Should IPB frames be discarded directly before receiving sps/pps? It should be possible to use this logic because without sps/pps, decoding is definitely not possible.

TRANS_BY_GPT3