Audio in playback of recorded events from RTSP streams not working

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
fmeili1
Posts: 14
Joined: Fri Jun 11, 2021 4:15 pm

Audio in playback of recorded events from RTSP streams not working

Post 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
fmeili1
Posts: 14
Joined: Fri Jun 11, 2021 4:15 pm

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

Post 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.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

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

Post 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.
-
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

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

Post 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.
fmeili1
Posts: 14
Joined: Fri Jun 11, 2021 4:15 pm

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

Post 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...
Post Reply