Page 1 of 1

h264 passthrough hikvision audio

Posted: Mon Nov 12, 2018 11:48 pm
by Pedulla
Hi ZM'rs,
Anyone figure out what ffmpeg options are needed to capture audio in the h264 passthrough of Hikvision 2dc2xx2 cams?

I stabilized the video recording by using: allowed_media_types=video

The other Important thing I discovered along the way is that it is critical the cameras dimension match those put in the source tab.... seems obvious but easily overlooked.

I'm running:
ZM1.32.2, UB18.04, LAMP, local spinners for storage.

Re: h264 passthrough hikvision audio

Posted: Wed Nov 21, 2018 2:28 am
by Pedulla
okay, is anybody with any camera capturing audio with H264 passthrough?

[Edit] on play back of course... There is no audio on live monitor.

Re: h264 passthrough hikvision audio

Posted: Sat Nov 24, 2018 10:15 pm
by tra
I have one camera audio works fine. It is Reolink RLC-410 and it outputs aac audio.
According to ffmpeg audio is: Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

But I have several cheap Chinese brand HJT cameras.
According to ffmpeg audio is: Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
And I can not get audio to work with zoneminder by these cameras. From log I can see error message (with these cameras):
[could not open codec (-22) (Invalid argument)]

I would appreciate a lot if somebody could give me some ideas how to get these cameras also works with audio. They should work because audio is working fine with pure ffmpeg.

I have wondered that in other thread here.

- TRa

Re: h264 passthrough hikvision audio

Posted: Mon Nov 26, 2018 8:17 pm
by iconnor
The best way would be to give Isaac access to the camera in question.

Re: h264 passthrough hikvision audio

Posted: Thu Nov 29, 2018 4:51 am
by Pedulla
Status Update:

When capturing directly with this

Code: Select all

ffmpeg -i rtsp://user:password@ -c:v copy -c:a aac foo.mp4

Code: Select all

title           : Media Presentation
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, q=2-31, 15 fps, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 48 kb/s
foo.mp4 has audio when played back.

I've upgraded to zoneminder_1.32.2_20181125102833-bionic_amd64.deb
I've tried putting the -c:v copy -c:a aac options in the storage tab (encoder parameters) and the source tab ffmpeg options.
Still no audio in the recorded event.

All of the Hikvision cameras, audio capable, exhibit this issue. (Chinese and Western Region)

Any ideas?

Re: h264 passthrough hikvision audio

Posted: Thu Nov 29, 2018 7:49 am
by Pedulla
Further Update:

Getting closer....

In the Options field on the Source tab, I replaced the

Code: Select all



Code: Select all

-ar 8000

It started recording audio, HOWEVER, the recorded video was all jacked up and didn't quit seem to be in sync with the video.

"Jacked up" means strange compression artifacts and the lower part of the image just melting away.
For some reason, in the 1.32 series of ZM, the Hikvision cameras do not work at their configured frame rate unless allowed_media... is used as above. And, the live view and recorded events are jacked up. (Note: didn't need the option in 1.30.4)

So progress, but not a solution yet.

I couldn't figure out how to stack options; using a comma to separate did not behave as expected.

Is there maybe something wrong with the parser for multiple options?
Can the streams audio sample rate be tested and made part of the call?
Is there some more debug information I can provide?

Re: h264 passthrough hikvision audio

Posted: Fri Nov 30, 2018 2:16 am
by Pedulla
Update - Initial Success

Upgraded to zoneminder_1.32.2~20181129142911-bionic_amd64.deb (soon to be known as 1.32.3 I think) from the master repo.

I am getting audio from my Hikvision cams now w/o any ffmpeg parameters in the source tab or storage tab.

I also removed the values from the Max FPS and Alarm Max FPS, which I believe were contributing/causing the jack up images, and rebooted each camera.

Woo Hoo!
Thanks iconnor

I've got about 30 more cams to reconfigure and will report back with those results.

Re: h264 passthrough hikvision audio

Posted: Wed Jan 16, 2019 12:43 am
by thefuzz4
What kind of mic are you using for these cams? I've got a few hikvisions in my system that I'd like to add a mic to. But since I'm using POE I've noticed that you can't use a powered mic and instead need a passive one. Thanks.