VAAPI HW Encoding and Storage issues

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
erew
Posts: 10
Joined: Wed May 06, 2020 4:39 pm

VAAPI HW Encoding and Storage issues

Post by erew »

I recently upgraded from 1.34 to 1.36 (latest build). Something was obviously changed in my Storage options > Optional Encoder Parameters and my video files are now huge. I can only store 2 days instead of 2 months. Nothing else has changed other than the upgrade.

I believe I had either a VAAPI or VPDAU setting in there, though I cannot find the correct setting to place back in there in any documentation, though I admit I am struggling to understand some documentation.

Does anyone know the correct settings? (I will provide build details and logs below)

If anyone has any suggestions or ideas, thanks in advance!

System Build
Intel i5-6600-T Skylake (Supports H264 Encoding/Decoding)
Ubuntu Linux 20.04.3
System is built with the "non-free drivers" for intel hardware graphics acceleration.

Environment Path contains (set in /etc/environment)
LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
LIBVA_DRIVER_NAME=iHD

Zoneminder Storage Settings
Video Source is a HTTP stream with no audio.
OutputCodec - I have tried H264 and Auto (currently on H264)
Encoder:
- lib264 (works but large files are created)
- H264 (works but large files are created)
- H264_VAAPI (Doesnt actually record anything other than a 800kb file, which only displays a black screen when played and outputs the error message shown below).

ZM log file w/ H264_VAAPI (set on Debug)
12/16/21 11:30:25.427348 zmc_m2[10685].INF-zm_monitor.cpp/2165 [Front-Camera: 1653 - Left alarm state (1468912) - 111(98) images]
12/16/21 11:30:25.427363 zmc_m2[10685].INF-zm_monitor.cpp/2170 [Front-Camera: 1653 - Closing event 1468912, alarm end]
12/16/21 11:30:25.850530 zmc_m2[10685].INF-zm_monitor.cpp/2076 [Front-Camera: 1658 - Gone into alarm state PreAlarmCount: 0 > AlarmFrameCount:1 Cause:Motion F-Far]
12/16/21 11:30:25.854996 zmc_m2[10685].ERR-zm_videostore.cpp/256 [Failed to create hwdevice_ctx]
12/16/21 11:30:25.855270 zmc_m2[10685].INF-zm_videostore.cpp/514 [some options not used, turn on debugging for a list.]
12/16/21 11:30:25.858488 zmc_m2[10685].ERR-zm_ffmpeg.cpp/558 [Could not send frame (error 'Invalid argument')]
12/16/21 11:30:25.858502 zmc_m2[10685].ERR-zm_videostore.cpp/1135 [Could not send frame (error 'Invalid argument')]
12/16/21 11:30:25.879067 zmc_m2[10685].ERR-zm_ffmpeg.cpp/558 [Could not send frame (error 'Invalid argument')]
12/16/21 11:30:25.879073 zmc_m2[10685].ERR-zm_videostore.cpp/1135 [Could not send frame (error 'Invalid argument')]
etc

Vainfo Output
libva info: VA-API version 1.12.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.12 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD

Vdpauinfo Output
display: :10.0 screen: 0
libva info: VA-API version 1.12.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
API version: 1
Information string: OpenGL/VAAPI backend for VDPAU

Video surface:

name width height types
-------------------------------------------
420 4096 4096 NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8
422 4096 4096 NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8
444 4096 4096 NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8

Decoder capabilities:

name level macbs width height
----------------------------------------------------
MPEG1 --- not supported ---
MPEG2_SIMPLE --- not supported ---
MPEG2_MAIN --- not supported ---
H264_BASELINE 51 16384 2048 2048
H264_MAIN 51 16384 2048 2048
H264_HIGH 51 16384 2048 2048
VC1_SIMPLE --- not supported ---
VC1_MAIN --- not supported ---
VC1_ADVANCED --- not supported ---
MPEG4_PART2_SP --- not supported ---
MPEG4_PART2_ASP --- not supported ---
DIVX4_QMOBILE --- not supported ---
DIVX4_MOBILE --- not supported ---
DIVX4_HOME_THEATER --- not supported ---
DIVX4_HD_1080P --- not supported ---
DIVX5_QMOBILE --- not supported ---
DIVX5_MOBILE --- not supported ---
DIVX5_HOME_THEATER --- not supported ---
DIVX5_HD_1080P --- not supported ---
H264_CONSTRAINED_BASELINE 51 16384 2048 2048
H264_EXTENDED --- not supported ---
H264_PROGRESSIVE_HIGH --- not supported ---
H264_CONSTRAINED_HIGH --- not supported ---
H264_HIGH_444_PREDICTIVE --- not supported ---
HEVC_MAIN --- not supported ---
HEVC_MAIN_10 --- not supported ---
HEVC_MAIN_STILL --- not supported ---
HEVC_MAIN_12 --- not supported ---
HEVC_MAIN_444 --- not supported ---

Output surface:

name width height nat types
----------------------------------------------------
B8G8R8A8 16384 16384 y
R8G8B8A8 16384 16384 y
R10G10B10A2 16384 16384 y
B10G10R10A2 16384 16384 y
A8 16384 16384 y

Bitmap surface:

name width height
------------------------------
B8G8R8A8 16384 16384
R8G8B8A8 16384 16384
R10G10B10A2 16384 16384
B10G10R10A2 16384 16384
A8 16384 16384

Video mixer:

feature name sup
------------------------------------
DEINTERLACE_TEMPORAL -
DEINTERLACE_TEMPORAL_SPATIAL -
INVERSE_TELECINE -
NOISE_REDUCTION -
SHARPNESS -
LUMA_KEY -
HIGH QUALITY SCALING - L1 -
HIGH QUALITY SCALING - L2 -
HIGH QUALITY SCALING - L3 -
HIGH QUALITY SCALING - L4 -
HIGH QUALITY SCALING - L5 -
HIGH QUALITY SCALING - L6 -
HIGH QUALITY SCALING - L7 -
HIGH QUALITY SCALING - L8 -
HIGH QUALITY SCALING - L9 -

parameter name sup min max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH -
VIDEO_SURFACE_HEIGHT -
CHROMA_TYPE -
LAYERS -

attribute name sup min max
-----------------------------------------------------
BACKGROUND_COLOR -
CSC_MATRIX -
NOISE_REDUCTION_LEVEL -
SHARPNESS_LEVEL -
LUMA_KEY_MIN_LUMA -
LUMA_KEY_MAX_LUMA -

ffmpeg Output
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
User avatar
kitkat
Posts: 193
Joined: Sun Jan 27, 2019 5:17 pm

Re: VAAPI HW Encoding and Storage issues

Post by kitkat »

I had a similar problem after one of the upgrades a little while ago (although not VAAPI related) and it was caused by some of the option parameters changing with use of libx264. The alternative syntax can be found here: https://ffmpeg.org/ffmpeg-codecs.html#Options-31

I also had to remove the #commented lines from the input box.
erew
Posts: 10
Joined: Wed May 06, 2020 4:39 pm

Re: VAAPI HW Encoding and Storage issues

Post by erew »

Thanks very much for the reply!! Its certainly been a puzzle because I know I had it working right up until the upgrade.

Ill try taking a look around that and see what I can find!
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: VAAPI HW Encoding and Storage issues

Post by iconnor »

1.34 didn't have vaapi encoding. Only software, so..
erew
Posts: 10
Joined: Wed May 06, 2020 4:39 pm

Re: VAAPI HW Encoding and Storage issues

Post by erew »

iconnor wrote: Thu Dec 16, 2021 9:55 pm 1.34 didn't have vaapi encoding. Only software, so..
Fair enough... though I know I had something on my Optional Encoder Parameters section and that really shrunk down the size of the files.... and it being so long ago that I set it up, I may therefore be half remembering. One of these rings a bell.. but Im not sure which one is correct.

hwaccel=vaapi
DecoderHWAccelName=vaapi

I don't suppose you might have a guess as to what I could put in there to shrink file size? Or why the h264_vaapi doesnt work? (only get a 800kb video file that is blank, and the error messages from my original post).

Thanks
Post Reply