ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
5.17k stars 1.23k forks source link

Unable to encode MPEG stream due to `EAGAIN` returned by `avcodec_receive_packet` #4104

Open LordMZTE opened 3 months ago

LordMZTE commented 3 months ago

Describe Your Environment

Describe the bug When attempting the view an MPEG stream through the web interface, the stream loads indefinetely and the attached errors are printed to the debug log.

To Reproduce This has been reproduces on a system with an NVidia T400 GPU intended for hardware decoding and encoding.

  1. Enable MPEG streaming
  2. Set these settings:
    • MPEG_LIVE_FORMAT = webm (also seems reproducable with mp4 here)
    • MPEG_REPLAY_FORMAT = webm
    • FFMPEG_INPUT_OPTIONS = -nostdin -err_detect aggressive -fflags discardcorrupt -vsync 0 -hwaccel cuvid -c:v h264_cuvid
    • FFMPEG_OUTPUT_OPTIONS = -c:v h264_nvenc -c:a copy -movflags frag_keyframe+empty_moov+faststart I don't quite recall where I got the latter two options from, but this seems to also happeen with them set to their defaults.
  3. Open any stream.

Expected behavior The stream is hardware encoded with the GPU and shows up properly in the browser.

Debug Logs https://gist.github.com/LordMZTE/f43463c8569cba69c4f15cb4f994cfe2

Additional Notes

It seems like the invokation to avcodec_receive_packet here returns EAGAIN which is incorrectly being treated as an error condition while it actually signals that more data is needed.

welcome[bot] commented 3 months ago

Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template!

connortechnology commented 3 months ago

Just a heads up until I can get around to looking further: I don't think the mpeg live view has worked for many years. It depended on flash actually. We currently support janus and rtsp2web for live view h264 (h265 doesn't work yet). Long term will likely go with go2rtc.