Randomly saving only JPEGs and no video after adding GPU

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

I had a stable setup, saving H.264 video without reencoding from my cameras. I'm recording continuously at 5 FPS, storing 10 minute videos that weigh about 300 MB each. I wanted to save disk space, so I added an NVIDIA GPU to compress the videos.
Under Source, I set:
DecoderHWAccelName: cuda
DecoderHWAccelDevice: 0

Under Storage, I set:
Save JPEGs: Disabled
Video Writer: Encode
OutputCodec: h264
Encoder: h264_nvenc
Optional Encoder Parameters: crf=28 -hwaccel cuda

I let it run for a while and was getting 25 MB video files. That was great. Then I came back later and saw that some of the events were taking 1 or 2 or 3 GB. Looking at the filesystem, I saw 3000 JPEGs in the event folder. Looking through the events for multiple monitors, I see some events that are 25 MB videos and some that are 3 GB of JPEGs. I see no pattern.

Did I set something wrong? What can I do to change this behavior? I'd appreciate any help.
User avatar
burger
Posts: 475
Joined: Mon May 11, 2020 4:32 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by burger »

I don't think the GPU is used to compress videos. It is used to offload some of the CPU to the GPU (and it is still in a preliminary state. There is more info here: https://wiki.zoneminder.com/GPU_passthr ... l_machines).

If JPEG encoding is disabled, you should not be seeing JPEGs. Please post screenshots of the monitor settings.

You can lower the size of the H264 passthrough videos, by adjusting the camera settings at the camera's webpage. You might lower the resolution or the bitrate. This article talks of adjusting the GOP. https://www2.acti.com/support_old/Packa ... 5E3364.PDF)
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

Screenshot 2025-05-08 at 09.38.47.png
Screenshot 2025-05-08 at 09.38.47.png (227.75 KiB) Viewed 3729 times
Screenshot 2025-05-08 at 09.38.59.png
Screenshot 2025-05-08 at 09.38.59.png (230.11 KiB) Viewed 3729 times
Screenshot 2025-05-08 at 09.39.20.png
Screenshot 2025-05-08 at 09.39.20.png (248.28 KiB) Viewed 3729 times
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

Screenshot 2025-05-08 at 09.37.28.png
Screenshot 2025-05-08 at 09.37.28.png (74.02 KiB) Viewed 3720 times
Screenshot 2025-05-08 at 09.37.45.png
Screenshot 2025-05-08 at 09.37.45.png (59.58 KiB) Viewed 3720 times
Screenshot 2025-05-08 at 09.37.58.png
Screenshot 2025-05-08 at 09.37.58.png (96.51 KiB) Viewed 3720 times
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

Screenshot 2025-05-08 at 09.36.38.png
Screenshot 2025-05-08 at 09.36.38.png (74.4 KiB) Viewed 3719 times
Screenshot 2025-05-08 at 09.36.13.png
Screenshot 2025-05-08 at 09.36.13.png (102.74 KiB) Viewed 3719 times
User avatar
burger
Posts: 475
Joined: Mon May 11, 2020 4:32 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by burger »

Enable debug logging on zmc for that monitor. Make sure that the GPU is actually running in ZM. What does it output?

To enable the debug log: Go to options, logging. Check off Debug log. Choose the filters you want to watch divided by a vertical line (e.g. _zmc_2|_zmc_3). Choose a destination that is e.g. /var/log/zm/zmc_debug_+ (otherwise it will go to the home folder by default). Restart ZM and post the relevant portion of the debug log here. I think there is a number for the debug. You might set it to 4 or 5.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

Hmm. I wasn't able to get logging to work. ls /var/log/zm shows nothing. If 5 is the ID of the monitor, should I use "_zmc_5" for the debug target?

However, nvtop shows the GPU is being used, if that is the info you're looking for.

Now that you mention it, though, I thought to look in in the normal log, and I see

Code: Select all

pkt.dts(32594180) must be <= pkt.pts(32578712).Decompression must happen before presentation.
I don't know what that means.

Thanks for your help.
Attachments
Screenshot 2025-05-08 at 17.00.36.png
Screenshot 2025-05-08 at 17.00.36.png (150.26 KiB) Viewed 3581 times
Screenshot 2025-05-08 at 16.59.24.png
Screenshot 2025-05-08 at 16.59.24.png (115.39 KiB) Viewed 3581 times
User avatar
burger
Posts: 475
Joined: Mon May 11, 2020 4:32 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by burger »

I've added a screenshot with the proper syntax for zmc: https://wiki.zoneminder.com/Filters#Log ... r_in_Debug

Though you may want to keep LOG_FFMPEG enabled, which you have in your screenshot. I'm not sure where the FFMPEG logs output to.

The debug target should be: _zmc_m### Where the number is the ID of the camera.. Make sure it is the 5th by reviewing the console. The ID will be listed in the first column on the grid in ZM 1.36 (or in top/htop/nvtop as you are seeing above).

/var/log/zm will have nothing unless you enable component / file logging or you specify debug logging to a target. You don't need to enable all file logging, only the monitor that we are concerned with here, which is #5. See the example above as a reference.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
aswine
Posts: 6
Joined: Wed May 07, 2025 1:59 pm

Re: Randomly saving only JPEGs and no video after adding GPU

Post by aswine »

If I'm understanding you, I just needed to change "_zmc_5" to "_zmc_m5". I did that, and I still see nothing in /var/log/zm, or /tmp/zm.

I'm using Debian; is there an issue with systemd logging or something? /var/log/syslog has lots of zm warnings of "Decompression must happen before presentation." as I said before.

And to clarify, the problem is happening with all cameras, not just #5.
Post Reply