Slow loading of event playback videos

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
dave_88
Posts: 34
Joined: Mon Feb 25, 2019 6:15 pm
Location: Northamptonshire, England UK

Slow loading of event playback videos

Post by dave_88 »

ZM 1.36.5
All cameras recording on passthrough, using mpeg playback via web console or zmNinja.

When I want to replay an event, it seems to take a long time to load (almost as if its loading the whole video; maybe it is?) It can take up to 40 seconds sometimes to load an event on the web console or zmNinja (and that's when on the LAN). Once it's loaded, I can jump to anywhere in the event without any noticeable buffering, so that's what makes me think the whole event is being "buffered" by the client before playback.

I can avoid this altogether if I set "movflags=frag_custom+dash+delay_moov" in the storage options for each camera, then videos start almost instantly, but then I obviously lose the ability to view an in-progress recording.

Is this simply just the trade-off I have to make, or is there a way to stick with the default encoder options AND speed up the time it takes for an event to start playing? I've tried playing with the bitrate and FPS on the relevant bandwidth tab and they don't seem to have any effect on the playback.

Loving ZM 1.36 BTW, got it running really nicely, and it seems really stable, with considerably less CPU and RAM usage.
dave_88
Posts: 34
Joined: Mon Feb 25, 2019 6:15 pm
Location: Northamptonshire, England UK

Re: Slow loading of event playback videos

Post by dave_88 »

Also noticed that very occasionally I am getting the following fatal error from web_php after changing the encoder options, assuming this is the event server requesting frames. Object detection works most of the time as far as I can tell, just get these errors a couple of times a day so assuming its missing some events if ffmpeg can't provide a still.
Can't create frame images from video for this event 640831-video.mp4 Command was: /usr/bin/ffmpeg -ss 0.00 -i /mnt/md0/events/5/2021-07-09/640831/640831-video.mp4 -frames:v 1 /mnt/md0/events/5/2021-07-09/640831/snapshot.jpg 2>&1 Output was: ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55bd2da91800] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible![mov,mp4,m4a,3gp,3g2,mj2 @ 0x55bd2da91800] moov atom not found
/mnt/md0/events/5/2021-07-09/640831/640831-video.mp4: invalid data found when processing input
incompetent-nerd
Posts: 10
Joined: Sat Jun 13, 2020 4:49 am

Re: Slow loading of event playback videos

Post by incompetent-nerd »

Hi Dave_88,

Try "movflags=faststart" instead and see if that works.
elchavodel8
Posts: 15
Joined: Thu Nov 09, 2017 7:03 pm

Re: Slow loading of event playback videos

Post by elchavodel8 »

dave_88 wrote: Wed Jul 07, 2021 7:26 pm ZM 1.36.5
All cameras recording on passthrough, using mpeg playback via web console or zmNinja.

When I want to replay an event, it seems to take a long time to load (almost as if its loading the whole video; maybe it is?) It can take up to 40 seconds sometimes to load an event on the web console or zmNinja (and that's when on the LAN). Once it's loaded, I can jump to anywhere in the event without any noticeable buffering, so that's what makes me think the whole event is being "buffered" by the client before playback.

I can avoid this altogether if I set "movflags=frag_custom+dash+delay_moov" in the storage options for each camera, then videos start almost instantly, but then I obviously lose the ability to view an in-progress recording.

Is this simply just the trade-off I have to make, or is there a way to stick with the default encoder options AND speed up the time it takes for an event to start playing? I've tried playing with the bitrate and FPS on the relevant bandwidth tab and they don't seem to have any effect on the playback.

Loving ZM 1.36 BTW, got it running really nicely, and it seems really stable, with considerably less CPU and RAM usage.
Did u find a solution to that? it super annoying when u need to review fast some videos , and it taking one minute to load 10 minute video :? :?
dave_88
Posts: 34
Joined: Mon Feb 25, 2019 6:15 pm
Location: Northamptonshire, England UK

Re: Slow loading of event playback videos

Post by dave_88 »

As per the suggestion by incompetent-nerd, on the monitors I am using motion detection, I commented out the existing movflags line and added the new line as follows in the Optional Encoder Parameters box in the Storage tab of the monitor configuration ...

Code: Select all

movflags=faststart
Downside is you can't view events until they've finished recording due to the way it writes the video files differently, but it loads events so much faster for playback.

I still get the very rare occurrence of the error I talked about above, but doesn't seem to cause any issues.
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Re: Slow loading of event playback videos

Post by Pedulla »

OMFG!
I've had this on my list to troubleshoot for a couple of years now. It was a frik'n hassle to go back to the 10min 24x7 recordings, but now, smooooooth and fast.
I initially thought this would only work if ZM was encoding the videos, but this works when the Video Writer is in Camera Passthrough.
Brilliant!

Note: It only effects new recordings after the change. Should be obvious, sometimes I miss the obvious ;)

Ubuntu 20.04LTS
LEMP Stack
ZM 1.36.33
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Slow loading of event playback videos

Post by iconnor »

Could make a filter to go through old recordings and apply it. Probably not worth it though. In 1.37, I added faststart to the default options. Doesn't seem to fix it everywhere though.
Post Reply