excellent - so one step closer to get this figured out

excellent - so one step closer to get this figured out
i think i figured this one out. i am running remote detection and at the time the detection service was requesting to access frame 00005 for analysis the event was still open in zm and the mp4 file generation therefore not completed yet. ffmpeg may presumably not be able to access frames from a video file of which the generation is still in progress and therefore failed to extract this frame. this error does not occur anymore once the mp4 file has been generated (i.e. once the event has been closed) and never occurs when frames are also written as jpegs. i will therefore leave the creation of jpegs enabled what will require more storage space but keep the object detection process as fast as it is todayeggenbef wrote: ↑Wed Nov 20, 2024 12:49 pm
also, if the creation of jpges is disabled then (and only then) the following error is raisedCode: Select all
11/20/24, 11:55:09 AM GMT+1 web_php 7634 ERR Can't create frame images from video for this event 56339-video.mp4Command was: /usr/bin/ffmpeg -ss 1.00 -i /media/user/LINUX-EXT/zmdata/2/2024-11-20/56339/56339-video.mp4 -frames:v 1 /media/user/LINUX-EXT/zmdata/2/2024-11-20/56339/00005-capture.jpg 2>&1Output was: ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11 (Ubuntu 11.2.0-19ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared 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 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5d4d656ce680] moov atom not found/media/user/LINUX-EXT/zmdata/2/2024-11-20/56339/56339-video.mp4: Invalid data found when processing input /usr/share/zoneminder/www/views/image.php 295
the video i just generated with 1.36.35 looks fine to me even though the zmc log was flooded with "non increasing dts" WAR messages during the whole recording period along with one single "non increasing dts" DB1 message (see attached). when debug level 3 or 2 was enabled then the logs did again not include any "non increasing dts" entries
Code: Select all
1393c1473
< last_dts[stream->index] = 0;
---
> last_dts[stream->index] = -1;
1397,1400c1477,1490
< if ((last_dts[stream->index] != AV_NOPTS_VALUE) and (pkt->dts < last_dts[stream->index])) {
< Warning("non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 ". reorder_queue_size=%zu",
< pkt->dts, stream->index, last_dts[stream->index], reorder_queue_size);
< pkt->dts = last_dts[stream->index];
---
> if (last_dts[stream->index] != AV_NOPTS_VALUE) {
> if (pkt->dts < last_dts[stream->index]) {
> Warning("non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 " difference %" PRId64 " last_duration %" PRId64 ". reorder_queue_size=%zu",
> pkt->dts, stream->index, last_dts[stream->index], (last_dts[stream->index]-pkt->dts), last_duration[stream->index], reorder_queue_size);
> pkt->dts = last_dts[stream->index]+last_duration[stream->index];
> if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
> } else if (pkt->dts == last_dts[stream->index]) {
> // Commonly seen
> Debug(1, "non increasing dts, fixing. our dts %" PRId64 " stream %d last_dts %" PRId64 ". reorder_queue_size=%zu",
> pkt->dts, stream->index, last_dts[stream->index], reorder_queue_size);
> // dts MUST monotonically increase, so add 1 which should be a small enough time difference to not matter.
> pkt->dts = last_dts[stream->index]+last_duration[stream->index]-1;
> if (pkt->dts > pkt->pts) pkt->pts = pkt->dts; // Do it here to avoid warning below
> }
please ignore this one - i was overlooking the cast to int64_t of this variable. any other/better suggestion?setting last_dts value to -1 and comparing it later on with a variable which was declared to be unsigned?
sure, no problem and thank you very much for your time/effort to get this sorted out
you are probably referring to this change which is referred to in the release notes of 1.36.34 as follows:
not sure where in the code of 1.36.33 the dts adjustment with an increment of 1 is carried out but in 1.36.35 the adjusted dts seems to be the last_duration added to the last_dts:Use last duration instead of 1 when adjusting dts when non-monotonic. Some googling indicates this might be a better approach. What I am seeing with a tapo C520WS agrees
Code: Select all
pkt->dts = last_dts[stream->index]+last_duration[stream->index];
Code: Select all
pkt->dts = last_dts[stream->index];
the trouble in the context of this thread seems to be that with 1.36.35 the calculated duration is also used to adjust the dts in case a non-monotonic value. this is not the case in release 1.36.33 where the adjustment is performed without using the calculated duration.
Code: Select all
11/29/24 09:29:35.997890 zmc_m2[9876].DB1-zm_videostore.cpp/1485 [non increasing dts, fixing. our dts 14 stream 0 last_dts 14. reorder_queue_size=0]
11/29/24 09:29:36.240651 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 22 stream 0 last_dts 25263 difference 25241 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:36.290810 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 22 stream 0 last_dts 46906 difference 46884 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:36.353377 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 24 stream 0 last_dts 68549 difference 68525 last_duration 21644. reorder_queue_size=0]
11/29/24 09:29:36.393698 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 26 stream 0 last_dts 90193 difference 90167 last_duration 25250. reorder_queue_size=0]
11/29/24 09:29:36.433611 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 27 stream 0 last_dts 115443 difference 115416 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:36.477248 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 28 stream 0 last_dts 137086 difference 137058 last_duration 21644. reorder_queue_size=0]
11/29/24 09:29:36.519754 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 28 stream 0 last_dts 158730 difference 158702 last_duration 21642. reorder_queue_size=0]
11/29/24 09:29:36.574932 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 29 stream 0 last_dts 180372 difference 180343 last_duration 25251. reorder_queue_size=0]
11/29/24 09:29:36.920052 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 29 stream 0 last_dts 205623 difference 205594 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:37.134891 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 30 stream 0 last_dts 227266 difference 227236 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:37.390334 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 27420 stream 0 last_dts 248909 difference 221489 last_duration 21644. reorder_queue_size=0]
11/29/24 09:29:37.555123 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 38409 stream 0 last_dts 270553 difference 232144 last_duration 25250. reorder_queue_size=0]
11/29/24 09:29:37.593100 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 58215 stream 0 last_dts 295803 difference 237588 last_duration 21643. reorder_queue_size=0]
11/29/24 09:29:38.349991 zmc_m2[9876].WAR-zm_videostore.cpp/1479 [non increasing dts, fixing. our dts 79297 stream 0 last_dts 317446 difference 238149 last_duration 21643. reorder_queue_size=0]
couldn't non-monotonic dts values be caused by heavy network traffic e.g. if packages are dropped? this might happen with a higher probability when debugging is off because the system will then probably run more performant and hence with a higher network impact.