Saving h264 using feature-h264-videostorage

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
JoeKeilty
Posts: 3
Joined: Wed Sep 07, 2016 2:22 pm

Re: Saving h264 using feature-h264-videostorage

Post by JoeKeilty »

Hi Steve.

First of all great work on this feature!

I've got it built and recording, trying both passthrough and encode.

I'm having issues playing the .mp4 files back however, particularly when using VLC.

The VLC player only displays the first frame of the video.

Sample of output VLC debug messages when playing one of the files:

Code: Select all

core warning: picture is too late to be displayed (missing 4279 ms)
core warning: picture is too late to be displayed (missing 285 ms)
core warning: picture is too late to be displayed (missing 325 ms)
avcodec warning: More than 4 late frames, dropping frame
avcodec warning: More than 4 late frames, dropping frame
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
core warning: picture is too late to be displayed (missing 4654 ms)
core warning: picture is too late to be displayed (missing 4656 ms)
core warning: picture is too late to be displayed (missing 4335 ms)
core warning: picture is too late to be displayed (missing 279 ms)
core warning: picture is too late to be displayed (missing 241 ms)
I am only recording video (I don't have record audio checked, and I have ran ffprobe on the files and it states there is only a video stream in the mp4).
The ffprobe output is as follows:

Code: Select all

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2-video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Zoneminder Security Recording
    encoder         : Lavf56.40.101
  Duration: 00:04:35.15, start: -1.195882, bitrate: 355 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 355 kb/s, 3 fps, 50 tbr, 12288 tbn, 6 tbc (default)
    Metadata:
      handler_name    : VideoHandler
If I go in VLC and alter the audio track synchronisation to -4s (speed it up by 4 seconds), the video plays fine.

Do you have any idea why this might be?
Are there any encoding parameters I could use to fix this? Or is it an issue with my cameras stream?

Thank you for your time!
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Saving h264 using feature-h264-videostorage

Post by SteveGilvarry »

At the moment it is just cutting the stream arbitarily at any point so videos are not starting on a keyframe. I wonder if that is vlc's issue? My symptom of this is playback in html5 viewer on event page can have a pause for a second or so before video begins. We are working on a buffer to hold previous frames so that might help.

Let me know if html5 video doesn't like it either.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
JoeKeilty
Posts: 3
Joined: Wed Sep 07, 2016 2:22 pm

Re: Saving h264 using feature-h264-videostorage

Post by JoeKeilty »

Plays through on the HTML5 player and on Windows Media Player - although I have noticed the symptom you describe. Cheers.
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Saving h264 using feature-h264-videostorage

Post by SteveGilvarry »

Admittedly I have not spent a lot of time trying to work it out, but where is that debug message in vlc? I could also be having issues as I am only playing with VLC in OS X.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
JoeKeilty
Posts: 3
Joined: Wed Sep 07, 2016 2:22 pm

Re: Saving h264 using feature-h264-videostorage

Post by JoeKeilty »

If you press CTRL+M it'll appear, or go Tools -> Messages. You can increase the verbosity to 2 (debug) and it'll show them.

Strangely, the videos I've recorded today play fine in VLC.

I'll do some investigation, but I have a hunch that the videos which were bugging out were recorded @ 3fps, whereas the ones today that have played fine were @ 6 fps.

Thanks.

Edit: Looks like videos @ 6FPS have been playing fine. I'm guessing @ 3FPS theres issues with the key-frame synchronisation like you were describing.
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: Saving h264 using feature-h264-videostorage

Post by abi »

I'm experimenting with storageareas branch. I have a problem with adding monitor
SQL-ERR 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'LinkedMonitors' cannot be null'
This is not related with mysql engine options as column is market as NOT NULL and NULL is really passed in.
I'm not sure that everyone is applied to www server as I created new one and maybe missed the obvious, but css looks something rough
http://i.imgur.com/Qc5ECHp.png
Vaso
Posts: 6
Joined: Mon Sep 19, 2016 6:31 am

Re: Saving h264 using feature-h264-videostorage

Post by Vaso »

+1
The same problem.
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: Saving h264 using feature-h264-videostorage

Post by abi »

Also, I need tips how to enable x264 encoding.
I compiled videostorage branch, added camera
1. SaveJPGs = Disabled
2. VideoWriter = x264 Encode
3. Monitor set to Record
After start I see zma eating a core (100%), mp4 file is created, but it's empty. (it has mp4 640 byte structure and that's all).
No error is printed

Code: Select all

09/19/16 12:27:01.777182 zma_m1[100201].DB1-zm_logger.cpp/234 [LogOpts: level=DB1/DB1, screen=OFF, database=INF, logfile=DB1->/var/log/zm/zm_debug.log, syslog=DB9]
09/19/16 12:27:01.777496 zma_m1[100201].DB1-zm_utils.cpp/262 [Detected a x86\x86-64 processor with SSSE3]
09/19/16 12:27:01.778102 zma_m1[100201].DB1-zm_monitor.cpp/2557 [Got 1 for v4l_captures_per_frame]
09/19/16 12:27:01.778263 zma_m1[100201].DB1-zm_monitor.cpp/375 [monitor purpose=2]
09/19/16 12:27:01.778293 zma_m1[100201].DB1-zm_monitor.cpp/384 [mem.size=471865072]
09/19/16 12:27:01.778837 zma_m1[100201].DB1-zm_monitor.cpp/449 [Monitor cam1 has function 4]
09/19/16 12:27:01.778884 zma_m1[100201].DB1-zm_monitor.cpp/450 [Monitor cam1 LBF = '%%N - %d/%m/%y %H:%M:%S', LBX = 0, LBY = 0, LBS = 2]
09/19/16 12:27:01.778903 zma_m1[100201].DB1-zm_monitor.cpp/451 [Monitor cam1 IBC = 50, WUC = 25, pEC = 25, PEC = 25, EAF = 1, FRI = 1000, RBP = 6, ARBP = 6, FM = 0]
09/19/16 12:27:01.778923 zma_m1[100201].DB1-zm_storage.cpp/52 [Loading Storage for 2 using SELECT Id, Name, Path from Storage WHERE Id=2]
09/19/16 12:27:01.779218 zma_m1[100201].INF-zm_storage.cpp/61 [Loaded Storage area 2 'test']
09/19/16 12:27:01.780309 zma_m1[100201].DB1-zm_monitor.cpp/454 [Storage path: /usr/local/www/zoneminder-h264/events]
09/19/16 12:27:01.787062 zma_m1[100201].DB1-zm_monitor.cpp/1748 [Reloading linked monitors for monitor cam1, '']
09/19/16 12:27:01.787619 zma_m1[100201].DB1-zm_zone.cpp/958 [Got 0 zones for monitor cam1]
09/19/16 12:27:01.787664 zma_m1[100201].DB1-zm_monitor.cpp/2820 [Loaded mon09/19/16 12:29:31.061542 zmc_m1[100186].INF-zm_monitor.cpp/2956 [cam1: 1000 - Capturing at 5.99 fps]
09/19/16 12:32:17.388133 zmc_m1[100186].INF-zm_monitor.cpp/2956 [cam1: 2000 - Capturing at 6.02 fps]
09/19/16 12:35:03.468648 zmc_m1[100186].INF-zm_monitor.cpp/2956 [cam1: 3000 - Capturing at 6.02 fps]
09/19/16 12:37:49.589738 zmc_m1[100186].INF-zm_monitor.cpp/2956 [cam1: 4000 - Capturing at 6.02 fps]
 "Normal" to DB]
09/19/16 12:27:06.780390 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 2 of type "Normal" to DB]
09/19/16 12:27:06.947125 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 3 of type "Normal" to DB]
09/19/16 12:27:07.119075 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 4 of type "Normal" to DB]
09/19/16 12:27:07.290584 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 5 of type "Normal" to DB]
09/19/16 12:27:07.464686 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 6 of type "Normal" to DB]
09/19/16 12:27:07.671904 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 7 of type "Normal" to DB]
09/19/16 12:27:07.804179 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 8 of type "Normal" to DB]
09/19/16 12:27:07.983111 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 9 of type "Normal" to DB]
09/19/16 12:27:08.185903 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 10 of type "Normal" to DB]
09/19/16 12:27:08.326844 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 11 of type "Normal" to DB]
09/19/16 12:27:08.470419 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 12 of type "Normal" to DB]
09/19/16 12:27:08.678735 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 13 of type "Normal" to DB]
09/19/16 12:27:08.850092 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 14 of type "Normal" to DB]
09/19/16 12:27:09.049639 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 15 of type "Normal" to DB]
09/19/16 12:27:09.219136 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 16 of type "Normal" to DB]
09/19/16 12:27:09.398819 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 17 of type "Normal" to DB]
09/19/16 12:27:09.537427 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 18 of type "Normal" to DB]
09/19/16 12:27:09.723790 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 19 of type "Normal" to DB]
09/19/16 12:27:09.863800 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 20 of type "Normal" to DB]
09/19/16 12:27:10.046336 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 21 of type "Normal" to DB]
09/19/16 12:27:10.223163 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 22 of type "Normal" to DB]
09/19/16 12:27:10.432847 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 23 of type "Normal" to DB]
09/19/16 12:27:10.607642 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 24 of type "Normal" to DB]
09/19/16 12:27:10.765260 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 25 of type "Normal" to DB]
09/19/16 12:27:22.697830 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 100 of type "Bulk" to DB]
09/19/16 12:27:39.341651 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 200 of type "Bulk" to DB]
09/19/16 12:27:55.991941 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 300 of type "Bulk" to DB]
09/19/16 12:28:12.595727 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 400 of type "Bulk" to DB]
09/19/16 12:28:29.168003 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 500 of type "Bulk" to DB]
09/19/16 12:28:45.816969 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 600 of type "Bulk" to DB]
09/19/16 12:29:02.388651 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 700 of type "Bulk" to DB]
09/19/16 12:29:18.980759 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 800 of type "Bulk" to DB]
09/19/16 12:29:35.623446 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 900 of type "Bulk" to DB]
09/19/16 12:29:48.044236 zma_m1[100201].INF-zm_monitor.cpp/1174 [cam1: 1000 - Analysing at 5.99 fps]
09/19/16 12:29:52.233878 zma_m1[100201].DB1-zm_event.cpp/629 [Adding frame 1000 of type "Bulk" to DB]
09/19/16 12:30:00.044299 zma_m1[100201].INF-zm_monitor.cpp/1380 [cam1: 1072 - Closing event 13, section end forced ]
09/19/16 12:30:00.045729 zma_m1[100201].DB1-zm_event.cpp/216 [Adding closing frame 1046 to DB]
x264 [info]: frame I:5     Avg QP:16.72  size:479417
x264 [info]: frame P:378   Avg QP:19.09  size:187825
x264 [info]: frame B:663   Avg QP:22.61  size: 57374
x264 [info]: consecutive B-frames:  0.5% 18.2% 80.6%  0.8%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%
x264 [info]: mb I  I16..4:  3.0%  0.0% 97.0%
x264 [info]: mb P  I16..4:  1.7%  0.0%  1.3%  P16..4: 53.9% 19.1% 22.5%  0.0%  0.0%    skip: 1.5%
x264 [info]: mb B  I16..4:  0.6%  0.0%  0.2%  B16..8: 18.2% 10.6%  2.0%  direct:44.8%  skip:23.5%  L0:35.0% L1:42.7% BI:22.3%
x264 [info]: coded y,uvDC,uvAC intra: 86.3% 70.5% 26.2% inter: 51.3% 44.0% 1.8%
x264 [info]: i16 v,h,dc,p: 12% 15% 67%  6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 22% 21%  7%  7%  5%  7%  5%  8%
x264 [info]: i8c dc,h,v,p: 48% 28% 20%  4%
x264 [info]: Weighted P-Frames: Y:24.1% UV:0.5%
x264 [info]: kb/s:5138.20
cmake detection, I have x264 and mp4v2:

Code: Select all

-- The C compiler identification is Clang 3.8.0
-- The CXX compiler identification is Clang 3.8.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_SENDFILE4_SUPPORT
-- Performing Test HAVE_SENDFILE4_SUPPORT - Failed
-- Performing Test HAVE_SENDFILE7_SUPPORT
-- Performing Test HAVE_SENDFILE7_SUPPORT - Success
-- Sendfile support: FreeBSD sendfile()
-- Looking for libv4l1-videodev.h
-- Looking for libv4l1-videodev.h - not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - not found
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Looking for backtrace
-- Looking for backtrace - not found
-- Looking for backtrace_symbols
-- Looking for backtrace_symbols - not found
-- Looking for ucontext.h
-- Looking for ucontext.h - found
-- Looking for sys/sendfile.h
-- Looking for sys/sendfile.h - not found
-- Looking for sys/syscall.h
-- Looking for sys/syscall.h - found
-- Looking for syscall
-- Looking for syscall - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of siginfo_t
-- Check size of siginfo_t - done
-- Check size of ucontext_t
-- Check size of ucontext_t - done
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.8") 
-- Looking for zlib.h
-- Looking for zlib.h - found
-- Found JPEG: /usr/local/lib/libjpeg.so  
-- Looking for include files stdio.h, jpeglib.h
-- Looking for include files stdio.h, jpeglib.h - found
-- Found OpenSSL: /usr/lib/libssl.so;/usr/lib/libcrypto.so (found version "1.0.2h") 
-- Looking for openssl/md5.h
-- Looking for openssl/md5.h - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for mysql.h
-- Looking for mysql.h - found
-- Looking for include files stdint.h, x264.h
-- Looking for include files stdint.h, x264.h - found
-- Looking for mp4v2/mp4v2.h
-- Looking for mp4v2/mp4v2.h - found
-- Looking for mp4v2.h
-- Looking for mp4v2.h - not found
-- Looking for mp4.h
-- Looking for mp4.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for libavcodec/avcodec.h
-- Looking for libavcodec/avcodec.h - found
-- Looking for libavdevice/avdevice.h
-- Looking for libavdevice/avdevice.h - found
-- Looking for libavutil/avutil.h
-- Looking for libavutil/avutil.h - found
-- Looking for libavutil/mathematics.h
-- Looking for libavutil/mathematics.h - found
-- Looking for libswscale/swscale.h
-- Looking for libswscale/swscale.h - found
-- Boost version: 1.55.0
CMake Warning (dev) at CMakeLists.txt:610 (message):
  Video 4 Linux headers weeren't found - Analog and USB camera support will
  not be available
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Checking prototype MD5 for HAVE_MD5_OPENSSL - True
-- Found Perl: /usr/local/bin/perl (found version "5.20.3") 
-- Checking for perl module Sys::Syslog
-- Checking for perl module Sys::Syslog - found at /usr/local/lib/perl5/5.20/mach/Sys/Syslog.pm
-- Checking for perl module DBI
-- Checking for perl module DBI - found at /usr/local/lib/perl5/site_perl/mach/5.20/DBI.pm
-- Checking for perl module DBD::mysql
-- Checking for perl module DBD::mysql - found at /usr/local/lib/perl5/site_perl/mach/5.20/DBD/mysql.pm
-- Checking for perl module Getopt::Long
-- Checking for perl module Getopt::Long - found at /usr/local/lib/perl5/5.20/Getopt/Long.pm
-- Checking for perl module Time::HiRes
-- Checking for perl module Time::HiRes - found at /usr/local/lib/perl5/5.20/mach/Time/HiRes.pm
-- Checking for perl module Date::Manip
-- Checking for perl module Date::Manip - found at /usr/local/lib/perl5/site_perl/Date/Manip.pm
-- Checking for perl module LWP::UserAgent
-- Checking for perl module LWP::UserAgent - found at /usr/local/lib/perl5/site_perl/LWP/UserAgent.pm
-- Checking for perl module ExtUtils::MakeMaker
-- Checking for perl module ExtUtils::MakeMaker - found at /usr/local/lib/perl5/5.20/ExtUtils/MakeMaker.pm
-- Checking for perl module Sys::Mmap
-- Checking for perl module Sys::Mmap - found at /usr/local/lib/perl5/site_perl/mach/5.20/Sys/Mmap.pm
-- Found PerlModules: TRUE  
-- Detected web server user: www
-- Using web user: www
-- Using web group: www
-- Using mootools core file: mootools-core-1.4.5-compat.js
-- Using mootools more file: mootools-more-1.5.1.js
-- Optional libraries found: zlib OpenSSL x264 mp4v2 AVFormat AVCodec AVDevice AVUtil SWScale
-- Optional libraries not found: PCRE GCrypt GnuTLS
Camera is spitting jpgs using Remote backend. ZM writes jpegs if save option is on.
Tried ffmpreg backend with the same result.
Here how I see events http://i.imgur.com/CF6hV83.png
mp4 file is 634bytes, other 16Kb is video.timecodes file.

_zma with 9 debug (end of event)

Code: Select all

09/19/16 13:09:59.753628 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 202507]
09/19/16 13:09:59.932361 zma_m1[100087].DB4-zm_monitor.cpp/1193 [RI:18, WI: 19, PF = 1, RM = 49, Step = 1]
09/19/16 13:09:59.932458 zma_m1[100087].DB3-zm_monitor.cpp/1266 [Motion detection is enabled signal(1) signal_change(0)]
09/19/16 13:09:59.932491 zma_m1[100087].DB3-zm_monitor.cpp/1373 [Section length (600) Last Section Mod(599), new section mod(599)]
09/19/16 13:09:59.932524 zma_m1[100087].DB4-zm_image.cpp/190 [Blend: Using SSE2 fast blend function]
09/19/16 13:09:59.932566 zma_m1[100087].DB4-zm_image.cpp/226 [Delta: Using SSSE3 delta functions]
09/19/16 13:09:59.932596 zma_m1[100087].DB4-zm_image.cpp/270 [Deinterlace: Using SSSE3 delta functions]
09/19/16 13:09:59.932625 zma_m1[100087].DB4-zm_image.cpp/283 [Image buffer copy: Using SSE2 aligned memcpy]
09/19/16 13:09:59.932652 zma_m1[100087].DB3-zm_image.cpp/290 [Setting up static colour tables]
09/19/16 13:09:59.945991 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1492 PTS: 261246 DTS: 260691 Size: 189631
]
09/19/16 13:09:59.946125 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 68959]
09/19/16 13:10:00.088799 zma_m1[100087].DB4-zm_monitor.cpp/1193 [RI:19, WI: 20, PF = 1, RM = 49, Step = 1]
09/19/16 13:10:00.088925 zma_m1[100087].DB3-zm_monitor.cpp/1266 [Motion detection is enabled signal(1) signal_change(0)]
09/19/16 13:10:00.088954 zma_m1[100087].DB3-zm_monitor.cpp/1373 [Section length (600) Last Section Mod(599), new section mod(0)]
09/19/16 13:10:00.088975 zma_m1[100087].INF-zm_monitor.cpp/1380 [cam1: 1519 - Closing event 19, section end forced ]
09/19/16 13:10:00.091703 zma_m1[100087].DB1-zm_event.cpp/216 [Adding closing frame 1493 to DB]
09/19/16 13:10:00.093100 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 261042 DTS: 260866 Size: 61496
]
09/19/16 13:10:00.093184 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 189631]
09/19/16 13:10:00.093427 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 261597 DTS: 261042 Size: 192833
]
09/19/16 13:10:00.093472 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 61496]
09/19/16 13:10:00.220890 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 261375 DTS: 261246 Size: 55784
]
09/19/16 13:10:00.221099 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 192833]
09/19/16 13:10:00.322249 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 261961 DTS: 261375 Size: 188524
]
09/19/16 13:10:00.322343 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 55784]
09/19/16 13:10:00.516973 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 261758 DTS: 261597 Size: 61509
]
09/19/16 13:10:00.517073 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 188524]
09/19/16 13:10:00.517355 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 262293 DTS: 261758 Size: 194483
]
09/19/16 13:10:00.517420 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 61509]
09/19/16 13:10:00.517548 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 262115 DTS: 261961 Size: 67246
]
09/19/16 13:10:00.517612 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 194483]
09/19/16 13:10:00.662911 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 262646 DTS: 262115 Size: 192946
]
09/19/16 13:10:00.663017 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 67246]
09/19/16 13:10:00.714265 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 262486 DTS: 262293 Size: 73917
]
09/19/16 13:10:00.714401 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 192946]
09/19/16 13:10:01.040904 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263018 DTS: 262486 Size: 193976
]
09/19/16 13:10:01.041000 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 73917]
09/19/16 13:10:01.044174 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 262819 DTS: 262646 Size: 68468
]
09/19/16 13:10:01.044307 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 193976]
09/19/16 13:10:01.048299 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263369 DTS: 262819 Size: 189821
]
09/19/16 13:10:01.048381 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 68468]
09/19/16 13:10:01.211534 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263175 DTS: 263018 Size: 65576
]
09/19/16 13:10:01.211668 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 189821]
09/19/16 13:10:01.234957 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263726 DTS: 263175 Size: 195700
]
09/19/16 13:10:01.235050 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 65576]
09/19/16 13:10:01.361087 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263536 DTS: 263369 Size: 71971
]
09/19/16 13:10:01.361245 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 195700]
09/19/16 13:10:01.511297 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264080 DTS: 263536 Size: 194058
]
09/19/16 13:10:01.511422 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 71971]
09/19/16 13:10:01.520755 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 263883 DTS: 263726 Size: 61159
]
09/19/16 13:10:01.520875 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 194058]
09/19/16 13:10:01.523427 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264410 DTS: 263883 Size: 193767
]
09/19/16 13:10:01.523537 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 61159]
09/19/16 13:10:01.673864 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264231 DTS: 264080 Size: 62270
]
09/19/16 13:10:01.673990 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 193767]
09/19/16 13:10:01.811694 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264756 DTS: 264231 Size: 201997
]
09/19/16 13:10:01.811772 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 62270]
09/19/16 13:10:01.847718 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264565 DTS: 264410 Size: 68896
]
09/19/16 13:10:01.847850 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 201997]
09/19/16 13:10:01.966154 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 265126 DTS: 264565 Size: 195353
]
09/19/16 13:10:01.966298 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 68896]
09/19/16 13:10:01.968923 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 264947 DTS: 264756 Size: 75123
]
09/19/16 13:10:01.969079 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 195353]
09/19/16 13:10:02.010082 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 265515 DTS: 264947 Size: 190452
]
09/19/16 13:10:02.010220 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 75123]
09/19/16 13:10:02.097542 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 265309 DTS: 265126 Size: 74660
]
09/19/16 13:10:02.097653 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 190452]
09/19/16 13:10:02.263478 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 265862 DTS: 265309 Size: 186914
]
09/19/16 13:10:02.263600 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 74660]
09/19/16 13:10:02.280753 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 265681 DTS: 265515 Size: 68649
]
09/19/16 13:10:02.280884 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 186914]
09/19/16 13:10:02.289621 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266223 DTS: 265681 Size: 184081
]
09/19/16 13:10:02.289703 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 68649]
09/19/16 13:10:02.590718 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266009 DTS: 265862 Size: 67510
]
09/19/16 13:10:02.590834 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 184081]
09/19/16 13:10:02.591092 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266572 DTS: 266009 Size: 174590
]
09/19/16 13:10:02.591154 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 67510]
09/19/16 13:10:02.667671 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266395 DTS: 266223 Size: 71604
]
09/19/16 13:10:02.667940 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 174590]
09/19/16 13:10:02.869828 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266939 DTS: 266395 Size: 157048
]
09/19/16 13:10:02.869936 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 71604]
09/19/16 13:10:02.887234 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 266743 DTS: 266572 Size: 69177
]
09/19/16 13:10:02.887328 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 157048]
09/19/16 13:10:02.889924 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 267294 DTS: 266743 Size: 134459
]
09/19/16 13:10:02.890074 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 69177]
09/19/16 13:10:03.049129 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 267088 DTS: 266939 Size: 72826
]
09/19/16 13:10:03.049267 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 134459]
09/19/16 13:10:03.049398 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 267487 DTS: 267088 Size: 100635
]
09/19/16 13:10:03.049451 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 72826]
09/19/16 13:10:03.049524 zma_m1[100087].DB8-zm_video.cpp/367 [x264 Frame: 1493 PTS: 267487 DTS: 267088 Size: 0
]
09/19/16 13:10:03.049584 zma_m1[100087].DB9-zm_video.cpp/376 [Processing NAL: Type 1 Size 100635]
x264 [info]: frame I:6     Avg QP:16.30  size:541864
x264 [info]: frame P:544   Avg QP:18.93  size:198991
x264 [info]: frame B:943   Avg QP:22.55  size: 64858
x264 [info]: consecutive B-frames:  0.7% 19.0% 79.0%  1.3%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%
x264 [info]: mb I  I16..4:  2.1%  0.0% 97.9%
x264 [info]: mb P  I16..4:  1.4%  0.0%  1.4%  P16..4: 57.0% 17.2% 21.5%  0.0%  0.0%    skip: 1.6%
x264 [info]: mb B  I16..4:  0.7%  0.0%  0.3%  B16..8: 17.2% 10.8%  2.1%  direct:47.6%  skip:21.3%  L0:36.0% L1:41.4% BI:22.6%
x264 [info]: coded y,uvDC,uvAC intra: 90.1% 67.8% 20.3% inter: 54.4% 47.5% 3.6%
x264 [info]: i16 v,h,dc,p:  9% 13% 72%  6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 22%  7%  7%  5%  7%  5%  8%
x264 [info]: i8c dc,h,v,p: 52% 26% 19%  3%
x264 [info]: Weighted P-Frames: Y:0.2% UV:0.2%
x264 [info]: kb/s:5160.27
09/19/16 13:10:03.077047 zma_m1[100087].DB7-zm_video.cpp/187 [Video closed. Total frames: 1493]
09/19/16 13:10:03.077330 zma_m1[100087].DB4-zm_ffmpeg.cpp/180 [SWScale object destroyed]
09/19/16 13:10:03.077360 zma_m1[100087].DB7-zm_video.cpp/37 [Video object destroyed]
09/19/16 13:10:03.086127 zma_m1[100087].DB7-zm_video.cpp/24 [Video object created]
09/19/16 13:10:03.086268 zma_m1[100087].DB4-zm_ffmpeg.cpp/135 [SWScale object created]
09/19/16 13:10:03.086324 zma_m1[100087].DB8-zm_ffmpeg.cpp/40 [Colours: 3 SubpixelOrder: 6]
All looks like it has data to write and it actually write it. What can be wrong ? And zma cpu pressure is really high.
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Saving h264 using feature-h264-videostorage

Post by SteveGilvarry »

Storageareas is a different branch with a few more experimental features, I don't run it currently. Some significant changes to the GUI are included so assume that is the CSS issues you are seeing. Hopefully iconnor sees your issues with Nulls and can have a look at it.

Not sure why it is not encoding, those on this branch using it currently have it working, I don't run it as my cameras are all h264, but I work with the guys on irc to fix any issues they come up with.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: Saving h264 using feature-h264-videostorage

Post by abi »

My cameras can output h264, however I want analysis, so I switched them to jpreg. I use record just for debugging. Probably I will do mocord later. The problem is that I have no even warning in log. I think we need more logging in zm_video.cpp. And CPU load is insane, this mode will be useless.
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: Saving h264 using feature-h264-videostorage

Post by abi »

x264 works for random swap frame from that camera, so I suppose it really should encode things

Code: Select all

abishai@zmh:/usr/ports/multimedia/zoneminder-h264 % ffmpeg -i /tmp/zmswap-i00003.jpg -c:v libx264 /tmp/test.mp4
ffmpeg version 2.8.7 Copyright (c) 2000-2016 the FFmpeg developers
  built with FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
  configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/share/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-pthreads --disable-libstagefright-h264 --disable-libutvideo --disable-libsoxr --cc=cc --extra-cflags='-msse -I/usr/local/include' --extra-ldflags='-L/usr/local/lib ' --extra-libs=-lpthread --disable-libaacplus --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt --disable-libdc1394 --disable-debug --disable-htmlpages --disable-libfaac --disable-libfdk-aac --disable-ffserver --disable-libflite --enable-fontconfig --enable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --disable-libgsm --enable-iconv --disable-libilbc --disable-indev=jack --disable-ladspa --disable-libmp3lame --disable-libbluray --enable-mmx --disable-libmodplug --disable-openal --disable-indev=openal --disable-opencl --disable-libopencv --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopus --disable-libpulse --disable-indev=pulse --disable-outdev=pulse --disable-libquvi --enable-runtime-cpudetect --disable-librtmp --disable-libschroedinger --disable-ffplay --disable-outdev=sdl --disable-libsmbclient --disable-libsnappy --disable-libspeex --enable-sse --disable-libssh --disable-libtheora --disable-libtwolame --disable-libv4l2 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-vaapi --disable-vdpau --disable-libvidstab --disable-libvorbis --disable-libvo-aacenc --disable-libvo-amrwbenc --disable-libvpx --disable-libwavpack --disable-libwebp --disable-x11grab --enable-libx264 --disable-libx265 --disable-libxcb --disable-libxvid --disable-outdev=xv --disable-libzmq --disable-libzvbi --disable-gnutls --enable-openssl --disable-version3 --enable-nonfree
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mjpeg @ 0x805616a00] Changeing bps to 8
Input #0, image2, from '/tmp/zmswap-i00003.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 63861 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 2048x1536 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
File '/tmp/test.mp4' already exists. Overwrite ? [y/N] y   
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x805617900] using SAR=1/1
[libx264 @ 0x805617900] using cpu capabilities: none!
[libx264 @ 0x805617900] profile High, level 5.0
[libx264 @ 0x805617900] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/tmp/test.mp4':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 2048x1536 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.60.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=28.0 Lsize=     168kB time=00:00:00.04 bitrate=34361.6kbits/s    
video:167kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.468989%
[libx264 @ 0x805617900] frame I:1     Avg QP:28.41  size:170317
[libx264 @ 0x805617900] mb I  I16..4:  2.8% 91.0%  6.2%
[libx264 @ 0x805617900] 8x8 transform intra:91.0%
[libx264 @ 0x805617900] coded y,uvDC,uvAC intra: 90.1% 73.7% 11.1%
[libx264 @ 0x805617900] i16 v,h,dc,p: 34% 25%  4% 37%
[libx264 @ 0x805617900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 16% 26%  8%  6%  6%  8%  8% 10%
[libx264 @ 0x805617900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 20% 16% 10%  9%  7%  9%  7%  7%
[libx264 @ 0x805617900] i8c dc,h,v,p: 46% 27% 24%  3%
[libx264 @ 0x805617900] kb/s:34063.40
Probing empty mp4 file after event is closed

Code: Select all

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x805692000] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 2048x1536): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
/usr/local/www/zoneminder-h264/events/1/16/09/19/14/22/16/29-video.mp4: End of file
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Saving h264 using feature-h264-videostorage

Post by SteveGilvarry »

What is should look like, running feature-h264-videostorage on Ubuntu 16.04.

Code: Select all

ffprobe version 2.8.6-1ubuntu2 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311
  configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '16659-video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2016-09-19 12:18:01
  Duration: 00:01:00.00, start: 0.602000, bitrate: 2711 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 2710 kb/s, 4.98 fps, 5 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      creation_time   : 2016-09-19 12:18:01
      encoder         : JVT/AVC Coding
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 2048x1536 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Is that a 3MP camera running at 25fps?
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: Saving h264 using feature-h264-videostorage

Post by abi »

Is that a 3MP camera running at 25fps?
That 3MP camera running at 6fps, above command was manually run against single jpeg from that camera just to see if x264 works at all. Second probe was run against mp4 produced by ZM. It has error, maybe track parameters was set incorrectly? That version worth to try.
Do you suggest feature-h264-videostorage ? Encoding routines are the same.
frekky
Posts: 1
Joined: Mon Sep 19, 2016 12:10 pm

Re: Saving h264 using feature-h264-videostorage

Post by frekky »

Hi.

I've been using this Zoneminder feature branch for a few weeks now and it's been working quite well, although I have noticed a few issues with the way events are recorded. I have 3 monitors configured, all recording from IP camera RTSP streams with ffmpeg, using H264 passthrough and set to mocord.
Sometimes playing back events (the "Continuous" events created due to continuous recording) the actual video that is saved is significantly shorter (6:24) than the 10 minute event interval that has been configured. A bit of searching in logs found the following: (the monitor is Garage)

Code: Select all

Sep 18 19:30:00 zoneminder zma_m2[15661]: INF [Garage: 227085 - Closing event 3532, section end]
Sep 18 19:30:00 zoneminder zma_m2[15661]: INF [Garage: 227085 - Opening new event 3535, section start]
Sep 18 19:30:00 zoneminder zmc_m2[13806]: INF [Re-starting video storage module]
Sep 18 19:30:00 zoneminder zmc_m2[13806]: INF [Opening video storage stream events/2/16/09/18/19/30/00/3535-video.mp4 format: 5094602#012]
Sep 18 19:30:00 zoneminder zmc_m2[13806]: INF [VideoStore startTime=-409096124#012]
Sep 18 19:31:31 zoneminder zmc_m2[13806]: INF [Garage: 458000 - Capturing at 6.02 fps]
Sep 18 19:32:32 zoneminder zma_m2[15661]: INF [Garage: 228000 - Analysing at 5.99 fps]
Sep 18 19:33:54 zoneminder zmc_m2[13806]: FAT [Unable to decode frame at frame 457870]
Sep 18 19:33:54 zoneminder zmc_m2[17329]: INF [Starting Capture version 1.30.0]
Sep 18 19:33:54 zoneminder zmc_m2[17329]: INF [Priming capture from rtsp://ipcamera:554/ch1.sdp?user=&pwd=]
Sep 18 19:33:54 zoneminder zmc_m2[17329]: INF [Stream open rtsp://ipcamera:554/ch1.sdp?user=&pwd=]
Sep 18 19:33:59 zoneminder zmc_m2[17329]: INF [Opening video storage stream events/2/16/09/18/19/30/00/3535-video.mp4 format: 5094602#012]
Sep 18 19:33:59 zoneminder zmc_m2[17329]: INF [VideoStore startTime=4914626#012]
Sep 18 19:35:19 zoneminder zma_m2[15661]: INF [Garage: 229000 - Analysing at 5.99 fps]
Sep 18 19:36:41 zoneminder zmc_m2[17329]: INF [Garage: 1000 - Capturing at 5.99 fps]
Sep 18 19:38:06 zoneminder zma_m2[15661]: INF [Garage: 230000 - Analysing at 5.99 fps]
Sep 18 19:39:28 zoneminder zmc_m2[17329]: INF [Garage: 2000 - Capturing at 5.99 fps]
Sep 18 19:39:55 zoneminder zma_m2[15661]: INF [Garage: 230656 - Gone into alarm state]
Sep 18 19:39:56 zoneminder zma_m2[15661]: INF [Garage: 230660 - Gone into alert state]
Sep 18 19:40:16 zoneminder zma_m2[15661]: INF [Garage: 230780 - Left alarm state (3535) - 3695(4) images]
Sep 18 19:40:16 zoneminder zma_m2[15661]: INF [Garage: 230781 - Closing event 3535, section end]
Sep 18 19:40:16 zoneminder zma_m2[15661]: INF [Garage: 230781 - Opening new event 3539, section start]
Sep 18 19:40:20 zoneminder zmc_m2[17329]: INF [Re-starting video storage module]
Sep 18 19:40:20 zoneminder zmc_m2[17329]: INF [Opening video storage stream events/2/16/09/18/19/40/16/3539-video.mp4 format: 5094602#012]
For the above, Zoneminder thinks the event began at 19:30:00 and lasts 616.58s, with 3696 frames (4 alarm). It appears the capture daemon resets about 3 minutes in due to some error (?) and overwrites the first 3 minutes, ending the event at the 10 minute interval (thus leaving 6 minutes of actual footage on disk although Zoneminder thinks it is actually 10 minutes long). The IP camera has its own timestamp and interestingly the zoneminder timestamp of the frames in the video (when played back through the web interface) is offset by the 3 minute delay - probably something to do with the way the timestamps are stored.

Hopefully this can be useful in some way :)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: Saving h264 using feature-h264-videostorage

Post by SteveGilvarry »

Frekky,
Yes that is useful, need to not fatal on bad frames, just move on. And do something to either split the event on an issue like this or if it finds an existing event file maybe try and keep going in that existing file. Not sure if the later is even possible.
Thanks Steve
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
Post Reply