Page 1 of 1

After move from 22.04 to 24.04 can't get video from one camera

Posted: Wed Apr 16, 2025 6:10 am
by faginbagin
A few days ago, I moved from ubuntu jammy 22.04 to ubuntu noble 24.04 running the same version of zoneminder, 1.36.35. Ever since then, zoneminder won't record video mp4 events for one camera, instead it only captures jpg frames. And I can't play those jpg versions from the zoneminder console. The camera in question is a wyze cam v2 with firmware that supports rtsp. I am getting video mp4 events for my other amcrest cameras. I captured debug output, the complete file from zmc process start to end is over 40 MB, but I think the relevant output is in these lines:

Code: Select all

04/16/25 00:33:14.513811 zmc_m8[51823].DB1-zm_event.cpp/625 [Starting event thread]
04/16/25 00:33:14.514300 zmc_m8[51823].DB1-zm_event.cpp/676 [Using storage area at /video4/zoneminder/events/8/2025-04-16/502656]
04/16/25 00:33:14.514327 zmc_m8[51823].DB1-zm_event.cpp/688 [Writing video file to /video4/zoneminder/events/8/2025-04-16/502656/502656-video.mp4]
04/16/25 00:33:14.514333 zmc_m8[51823].DB4-zm_swscale.cpp/27 [SWScale object created]
04/16/25 00:33:14.514352 zmc_m8[51823].DB1-zm_videostore.cpp/119 [Opening video storage stream /video4/zoneminder/events/8/2025-04-16/502656/502656-video.mp4 format: mp4]
04/16/25 00:33:14.514451 zmc_m8[51823].DB1-zm_ffmpeg.cpp/238 [Dumping codecpar codec_type(0 video) codec_id(27 h264) codec_tag(0) width(1920) height(1080) bit_rate(0) format(0 yuv420p)]
04/16/25 00:33:14.514483 zmc_m8[51823].DB2-zm_videostore.cpp/193 [No timebase found in video in context, defaulting to Q]
04/16/25 00:33:14.514488 zmc_m8[51823].DB1-zm_ffmpeg.cpp/254 [Dumping codec_context codec_type(0 video) codec_id(27 h264) width(1920) height(1080)  timebase(1/1000000) format(yuv420p) gop_size 12 max_b_frames 0 me_cmp 0 me_range 0 qmin 2 qmax 31]
04/16/25 00:33:14.514506 zmc_m8[51823].DB3-zm_videostore.cpp/375 [Have orientation 1]
04/16/25 00:33:14.514510 zmc_m8[51823].DB2-zm_videostore.cpp/393 [Have audio_in_stream 0x58bd1d2279c0]
04/16/25 00:33:14.515941 zmc_m8[51823].DB2-zm_videostore.cpp/810 [Got something other than AAC (pcm_alaw)]
04/16/25 00:33:14.516030 zmc_m8[51823].DB3-zm_videostore.cpp/853 [Sample rate is good 8000]
04/16/25 00:33:14.516037 zmc_m8[51823].DB2-zm_ffmpeg.cpp/381 [Not fltp]
04/16/25 00:33:14.516040 zmc_m8[51823].DB3-zm_videostore.cpp/863 [Encoder does not support sample format s16, setting to FLTP]
04/16/25 00:33:14.516442 zmc_m8[51823].WAR-zm_ffmpeg.cpp/69 [Unsupported channel layout "1 channels"]
04/16/25 00:33:14.516602 zmc_m8[51823].DB1-zm_ffmpeg.cpp/69 [Qavg: nan]
04/16/25 00:33:14.516648 zmc_m8[51823].ERR-zm_videostore.cpp/879 [could not open codec (-22) (Invalid argument)]
04/16/25 00:33:14.516754 zmc_m8[51823].WAR-zm_event.cpp/702 [Failed to open videostore, turning on jpegs]
I can play the rtsp stream on Windows/vlc, but can't on Ubuntu/vlc. Here's what it says about the audio stream:

Code: Select all

Codec: PCM ALAW (alaw)
Type: Audio
Channels: Mono
Sample rate: 8000 Hz
Bits per sample: 16
My guess is that I'm missing some codec so I'm attaching the output from "ffmpeg -codecs". I do see codecs for both pcm_alaw and aac in that file, as well as some s16 codecs, but no codecs containing fltp:

Code: Select all

 DEAIL. aac                  AAC (Advanced Audio Coding) (decoders: aac aac_fixed)
 D.AIL. aac_latm             AAC LATM (Advanced Audio Coding LATM syntax)
 DEAIL. pcm_alaw             PCM A-law / G.711 A-law
 DEAI.S pcm_s16be            PCM signed 16-bit big-endian
 DEAI.S pcm_s16be_planar     PCM signed 16-bit big-endian planar
 DEAI.S pcm_s16le            PCM signed 16-bit little-endian
 DEAI.S pcm_s16le_planar     PCM signed 16-bit little-endian planar
I do not have any of the libav*-extra packages installed on noble/24.04, and I did not have them installed on jammy/22.04. But maybe I need them now?

Some background on how I upgrade. When I want to upgrade the OS, I don't do it in place, instead I do a clean install on a second partition. That allows me to boot into either old (jammy) or new (noble) and test the new stuff while being able to revert to the old easily. I have the same version of zoneminder (1.36.35) installed on jammy and noble from https://launchpad.net/~iconnor/+archive ... inder-1.36

If there's interest, I'll put the full debug log on google drive. Thanks in advance for any help.

Re: After move from 22.04 to 24.04 can't get video from one camera

Posted: Tue May 20, 2025 1:28 am
by faginbagin
I believe have figured out the problem and have a fix.

I am attaching some debug logs that show the difference in behavior on ubuntu noble vs ubuntu jammy. They are partial logs, containing only the output from the thread that is spawned to create and store an event. I've stripped out the time stamps to make them easier to read and added my notes as I went thru them and the code.

It has to do with the ffmpeg libraries used on ubuntu jammy vs ubuntu noble. In particular, when it comes to dealing with cameras who's audio is not AAC. When recording an event, zoneminder wants to transcode such audio to AAC but some cameras produce audio that needs a little extra code to figure out the input audio channel layout. There have been changes to the libavcodec library that deprecated and broke the zoneminder code that did this. It appears that the problematic channel layout code was effectively commented out with #ifdef's on ubuntu noble.

I think I found a proper fix to the deprecated channel layout code by looking at ffmpeg example code, in particular:
https://github.com/FFmpeg/FFmpeg/blob/0 ... #L302-L309

What's unclear to me is whether I should first create a github issue followed by a pull request or just do a pull request referring to this forum post, or something else? The documentation on contributing to zoneminder isn't very clear on this. The "github posting rules" page talks about the github forum for zoneminder, and has a link to the main zoneminder project page. Is "github forum" a reference to the issues section or to the discussions section? There's also a link to a slack channel: https://zoneminder-chat.herokuapp.com/, which is broken. Third is a link to what is probably supposed to be this forum: http://www.zoneminder.com/forums/, but that's also broken. Contributing.md also mentions an IRC channel, but no link, so I don't know where it's hosted.

Please advise.

Re: After move from 22.04 to 24.04 can't get video from one camera

Posted: Tue May 20, 2025 2:01 am
by faginbagin
Forgot to add that I have seen this problem with 3 cameras, all from different manufacturers:
  1. Wyze Cam v2 with firmware that supports rtsp, https://www.wyze.com/products/wyze-cam-v2
  2. FOSCAM Security Camera WiFi IP Home Camera,R2C 1080P HD Baby Monitor Wireless Pet Camera with AI Human & Sound Detection, https://www.amazon.com/dp/B07BLQZVDK?re ... _title_0_1
  3. Wansview Wireless 1080P Security Camera, WiFi Home Surveillance IP Camera for Baby/Elder/Pet/Nanny Monitor, Pan/Tilt, Two-Way Audio & Night Vision SD Card Slot Q3-S, https://www.amazon.com/dp/B075K89NTR?re ... in_title_4

Re: After move from 22.04 to 24.04 can't get video from one camera

Posted: Tue May 20, 2025 2:58 am
by faginbagin
I should have looked at https://zoneminder.readthedocs.io/. Under contributing, it says to create a github issue as well as a pull request.

Maybe it's time to clean up the obsolete info on the github wiki?

Anyway, here's the github issue: https://github.com/ZoneMinder/zoneminder/issues/4328

And the pull request: https://github.com/ZoneMinder/zoneminder/pull/4327