Page 1 of 1

Audio in playback of recorded events from RTSP streams not working

Posted: Fri Jul 23, 2021 10:11 pm
by fmeili1
I'm using Zoneminder v1.36.4 and followed all instructions to be able to setup audio like

- set "Source Type" to "Ffmpeg" in "General" config
- set "Video Writer" to "Camera Passthrough" in "Storage" config
- enable the option "Whether to store the audio stream when saving an event." in "Storage" config

I've red, that monitor live viewing in Zoneminder does not support audio (which is ok for me), but it should work in recorded events.

The camera provides two streams (low res and hi res) both with audio support. The URL's are

LowRes: rtsp://<userid>:<pw>@<cameraIP>:554/h264Preview_01_sub
HiRes: rtsp://<userid>:<pw>@<cameraIP>:554/h264Preview_01_main

The streams seems to be ok, because the following three command line tests worked with audio on both streams

- vlc "rtsp://<userid>:<pw>@<cameraIP>:554/h264Preview_01_main"
- ffplay -i rtsp://<userid>:<pw>@<cameraIP>:554/h264Preview_01_main
- ffmpeg -i rtsp://<userid>:<pw>@<cameraIP>:554/h264Preview_01_main foo.mp4
(and playing foo.mp4 later with an other player)

So it must have do to with my Zoneminder settings, which I may not use in the correct way?

What am I doing wrong?

Btw. The cameras also support RTMP streaming and with RTMP URL's the audio recording/playback in Zoneminder works, but unfortunately I can't use these RTMP streams because of a camera firmware bug which makes it impossible to use the RTMP streams in general (they freeze after some hours and only a camera reboot will help than and the camera vendor told me that I have to use RTSP streams to get rid of that problem with...)

Thanks,
Frank

Re: Audio in playback of recorded events from RTSP streams not working

Posted: Fri Jul 23, 2021 11:52 pm
by fmeili1
I want to add, that VLC media info for the codec shows the following entries:

Code: Select all

Stream 0
  Codec: H264 - MPEG-4 AVC (part 10) (h264)
  Type: Video
  Video resolution: 2048x1536
  Buffer dimensions: 2048x1536
  Frame rate: 29.970030
  Decoded format: 
  Orientation: Top left

Stream 1
  Codec: MPEG AAC Audio (mp4a)
  Type: Audio
  Channels: Stereo
  Sample rate: 32000 Hz
  Bits per sample: 32
And ffplay shows the following metadata in the console for the same stream for the same camera:

Code: Select all

  Metadata:
    title           : Session streamed by "preview"
    comment         : h264Preview_01_main
  Duration: N/A, start: 0.000250, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 2048x1536, 30 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
I don't know why VLC shows stereo with 32kHz and ffply shows mono 16kHz, but both play the sound of the stream without any problems.

Re: Audio in playback of recorded events from RTSP streams not working

Posted: Sat Jul 24, 2021 6:40 am
by Magic919
Sampling rates and how to report them in AAC. There are features of AAC audio compression that halve the sampling rate. Have a read of the spec and look at SBR and also PS. It explains why some streams get reported as mono too.

Re: Audio in playback of recorded events from RTSP streams not working

Posted: Mon Jul 26, 2021 3:40 am
by Pedulla
Look at how your camera is setup to encode the audio. G.711ulaw works on ZM

If you're playing back the video on your workstation with a decoder that supports whatever your camera is kicking out, that might be why you get audio in a player but it's not recorded on ZM.

Re: Audio in playback of recorded events from RTSP streams not working

Posted: Tue Jul 27, 2021 12:01 pm
by fmeili1
Thanks for clarification. Unfortunately, the Reolink RLC-510A does not support changing the audio streaming mode. It looks like that when streaming with RTMP the camera audio stream uses the one which ZM needs (G.711ulaw) and it works, but when using RTSP stream the audio seems to be in a different format and ZM audio recording does not work with that. Because of a firmware bug with RTMP in the camera I can't use that type of stream. Maybe I can try to find "Optional Encoder Parameters" in the ZM "Storage" options for Ffmpeg to influence audio encoding and bring it to work...