Closed josiahbryan closed 2 years ago
Not sure if this helps at all, but even ffmpeg complains about the stream it's getting (see "Non-monotonous DTS in output stream" below)
This was discovered after adding the ffmpeg command shown in https://github.com/aler9/rtsp-simple-server#save-streams-to-disk for saving streams to disk
2022/07/16 15:55:28 INF [path exit-cam] runOnReady command started
2022/07/16 15:55:28 INF [path exit-cam] [rtsp source] ready
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
2022/07/16 15:55:28 INF [RTSP] [conn [::1]:61624] opened
2022/07/16 15:55:28 INF [RTSP] [session 690179960] created by [::1]:61624
2022/07/16 15:55:28 INF [RTSP] [session 690179960] is reading from path 'exit-cam', 2 tracks with UDP
2022/07/16 15:55:29 INF [RTSP] [conn 127.0.0.1:61625] opened
2022/07/16 15:55:29 INF [RTSP] [session 892534563] created by 127.0.0.1:61625
2022/07/16 15:55:29 INF [RTSP] [session 892534563] is reading from path 'exit-cam', 2 tracks with TCP
Input #0, rtsp, from 'rtsp://localhost:8554/exit-cam':
Metadata:
title : Stream
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
[segment @ 0x7ff406813a00] Opening '/tmp/gcap/exit-cam_2022-07-16_15-55-31.ts' for writing
Output #0, segment, to '/tmp/gcap/exit-cam_%Y-%m-%d_%H-%M-%S.ts':
Metadata:
title : Stream
encoder : Lavf58.76.100
Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, q=2-31, 24.92 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[segment @ 0x7ff406813a00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x7ff406813a00] Non-monotonous DTS in output stream 0:0; previous: 5296621, current: 5290985; changing to 5296622. This may result in incorrect timestamps in the output file.
[segment @ 0x7ff406813a00] Non-monotonous DTS in output stream 0:0; previous: 5296622, current: 5294592; changing to 5296623. This may result in incorrect timestamps in the output file.
[segment @ 0x7ff406813a00] Opening '/tmp/gcap/exit-cam_2022-07-16_15-56-30.ts' for writing
[segment @ 0x7ff406813a00] Non-monotonous DTS in output stream 0:0; previous: 8892995, current: 8886910; changing to 8892996. This may result in incorrect timestamps in the output file.
[segment @ 0x7ff406813a00] Non-monotonous DTS in output stream 0:0; previous: 8892996, current: 8890517; changing to 8892997. This may result in incorrect timestamps in the output file.
[segment @ 0x7ff406813a00] Opening '/tmp/gcap/exit-cam_2022-07-16_15-57-30.ts' for writing
Any traction on this issue? Major problem and blocker for us
Hello,
The server uses a ring buffer (https://en.wikipedia.org/wiki/Circular_buffer) in order to read streams from cameras and write streams to readers. readBufferCount
is used to tune the size of that buffer and indicates the maximum number of packets that are kept into the server, waiting to be sent to clients.
If you're having problems when the number of connected clients increases, it means that there's a bottleneck, either at the CPU level or at the network level, and the ring buffer can't keep up and starts discarding packets. It happens when the server isn't able to read or write packets fast enough.
You can
This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.
Which version are you using?
v0.19.2
Which operating system are you using?
Describe the issue
When running with 2 cameras (inputs) + 4 clients, starting to get errors intermittently in client decoders (note the lines starting with
[rtsp @...]
and[hevc @...]
.The only thing I've found to help is increasing
readBufferCount
... but not sure what values to use there or how high to go. I have it up at4096
and still getting problems. Should I go higher? Are there other values I can tweak?(I've tried setting sourceProto to TCP but TCP vs UDP makes no difference on the cameras as far as these errors are concerned)
Describe how to replicate the issue
Did you attach the server logs?
N/A
Did you attach a network dump?
No
Config being used for the rtsp-simple-server instance (passwords removed):
And here's the config I'm using for the Plate Recognizer, edited to remove sensitive paths: