UNEXPECTED_FAILURE and my fix
my cam hikvision DS-KV6113-WPE1 works fine: hsv, local recording - everything is fine. but after ~3 hours i always receive an error:
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon:       handler_name    : SoundHandler
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon:       vendor_id       : [0][0][0][0]
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon:       encoder         : Lavc58.134.100 libfdk_aac
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon: frame=  100 fps=0.0 q=-1.0 size=       1kB time=00:00:07.21 bitrate=   1.4kbits/s speed=4.32e+03x
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon: Recording started
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon: New motion detected, resetting motion in 20s..
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon: Motion data: [{"zone":"region0","percent":5.520995616912842,"sensitivity":95,"dwell":20,"forceClose":1}]}
> [2/1/2022, 7:45:26 PM] [CameraUI] domofon: frame=  200 fps=0.0 q=-1.0 size=    1060kB time=00:00:11.21 bitrate= 774.8kbits/s speed=22.3x
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: Closing recording process
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: Resetting motion sensor, because HSV closed the recording process
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: Motion OFF
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: FFMPEG socket closed during read for 8 bytes!
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: The recording process was aborted by HSV with reason "UNEXPECTED_FAILURE"
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: Prebuffer request ended
> [2/1/2022, 7:45:27 PM] [CameraUI] domofon: FFmpeg recording process exited (expected)
> 

hsv stops. so i have to restart homebridge and receive another ~3 hours of fine work.

i made some tests. clean ffmpeg with only copy streams and tcp rtsp transport shows me some second sound lag after an hour of recording. so the problem is in my cam and desynchronization of audio and video streams. there is no config for audio in my cam.

in camera-ui prebuffer ffmpeg command have "-fflags +genpts" but it's not enough to fix stream. fortunately we works with real time cams and we can add "-use_wallclock_as_timestamps 1".
as i see there is no possibility to add params BEFORE input stream of ffmpeg in config json or UI. so i have to use hack and 

**setup rtsp transport as "tcp -use_wallclock_as_timestamps 1".**

after it i have got camera-ui works for 2 days without restart. but with warnings

> Non-monotonous DTS in output stream 0:1; previous: 781880, current: 779500; changing to 781881. This may result in incorrect timestamps in the output file

i think most (!) of all cams have got a sound lags problem. some cams have got an little, some big. sheduled prebuffer restart helps, but not for everyone.

fix:
add "-use_wallclock_as_timestamps 1" or another params that repair streams synchronisation (may be -async 1000 will help)

suggestions:
1 add json/ui params that will be inserted in ffmpeg command before input stream
2 param to control how offten prebufer process should restart
