sergey-dryabzhinsky / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
1.02k stars 217 forks source link

hls: not enough buffer for NAL #323

Closed zotanmew closed 3 years ago

zotanmew commented 3 years ago

I'm streaming with an unusually high bitrate (25000kbps), and I randomly get this error. (hls: not enough buffer for NAL) Happens every 5-10 minutes, and when it does, it stops creating new fragments for about 15 seconds, which causes my player to buffer (playlistlen is set to 10 seconds), after which it resumes as normal. I cannot reproduce the error while streaming with a lower bitrate (15000kbps), and a google search only lead me to the source code and an issue on the arut repo from 2013, with no hints other than patching ffmpeg fixed in, which doesn't seem applicable here as I am not using ffmpeg. And leads would be appreciated!

ctaity commented 3 years ago

Try put a higher buffer or use srt to send this high bitrate.

On 18 Jan 2021, at 16:23, Laura Hausmann notifications@github.com wrote:

a

zotanmew commented 3 years ago

@ctaity which buffer are you talking about specifically? i couldn't find anything related in the directives

zotanmew commented 3 years ago

Patching the file/hls/ngx_rtmp_hls_module.c to #define NGX_RTMP_HLS_BUFSIZE (1024*1024*16) seems to have fixed it, but it seems unlikely that patching the source code is the right way to go about this

ctaity commented 3 years ago

In ffmpeg when you receive, you can put:

buflen 5s; https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/blob/dev/doc/directives.md#out_queue https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/blob/dev/doc/directives.md#buflen

And

chunk_size

Maximum chunk size for stream multiplexing. Default is 4096. The bigger this value the lower CPU overhead. This value cannot be less than 128.

My experience with high bitrate (streaming 25 to 50 mbps) srt protocol is much better than rtmp.

On 18 Jan 2021, at 16:26, Laura Hausmann notifications@github.com wrote:

@ctaity https://github.com/ctaity which buffer are you talking about specifically? i couldn't find anything related in the directives

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/323#issuecomment-762433426, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHXPNQVZUUOKQMQUR6J5ZDS2SDP3ANCNFSM4WHXOIYA.

zotanmew commented 3 years ago

@ctaity i am not using ffmpeg though... regarding srt, do you know of any good replacement for this module that supports srt? i would love to use it..

ctaity commented 3 years ago

https://github.com/Haivision/srt/blob/master/docs/srt-live-transmit.md https://github.com/Haivision/srt/blob/master/docs/srt-live-transmit.md

I use srt like this:

—> ffmpeg (pipe or mpeg udp) —> srt-live-tranmit —> internet —> srt-live-tranmit (udp) —> ffmpeg rtmp —> hls

If you need help with this setup yo can contact me on: ctaity@gmail.com mailto:ctaity@gmail.com via hangouts.

On 18 Jan 2021, at 16:32, Laura Hausmann notifications@github.com wrote:

@ctaity https://github.com/ctaity i am not using ffmpeg though... regarding srt, do you know of any good replacement for this module that supports srt? i would love to use it..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/323#issuecomment-762435679, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHXPNVM32B646AGHHXXKSLS2SEF3ANCNFSM4WHXOIYA.