connortechnology / ZoneMinder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
9 stars 9 forks source link

Audio stream causes issues with events #103

Open shaun-ba opened 5 years ago

shaun-ba commented 5 years ago

@connortechnology Unfortunately another one, on 1.32.0 this time.

One thing I am trying is the H.264+ option from Hikvision, I believe it's a different compression, and I'm using G.711 audio codec. Events do record but they keep crashing.

2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 7: /usr/bin/zmc(_start+0x29) [0x55c6b1cd20f9] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 6: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f5d24a74830] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 5: /usr/bin/zmc(main+0xa78) [0x55c6b1ccf948] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 4: /usr/bin/zmc(_ZN12FfmpegCamera5CloseEv+0x146) [0x55c6b1da5e86] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 3: /usr/bin/zmc(_ZN10VideoStoreD1Ev+0x7c7) [0x55c6b1d5ba07] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 2: /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56(avcodec_close+0x33) [0x7f5d26098cbf] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 1: /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f5d28c5a390] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Backtrace 0: /usr/bin/zmc(_Z14zm_die_handleriP9siginfo_tPv+0x78) [0x55c6b1d3e768] zm_signal.cpp 102
2018-09-28 08:55:09 zmc_m3   27846 ERR Signal address is (nil), from 0x7f5d26098cbf zm_signal.cpp 81
2018-09-28 08:55:09 zmc_m3   27846 ERR Got signal 11 (Segmentation fault), crashing zm_signal.cpp
connortechnology commented 5 years ago

We have fixed a couple more crashes and weirdnesses over the last two days. Is your code up to date as of yesterday afternoon? If not, please update and try again.

connortechnology commented 5 years ago

Oh and I will need logs.

shaun-ba commented 5 years ago

@connortechnology I try my best to get logs, but with the previous issue I had with codec there were none, in any log file with top level debugging on.

Does ZM support H.264+ encoding ?

I have monitors on record at 10minute intervals, and i'm getting lots of random length events, but no ERR logs, which component should I add debugging to to get logs for that ?

connortechnology commented 5 years ago

I have no idea about h.264+ encoding. Regardless it shouldn't cause a crash.

You say you have no err logs, but above you posted err logs. WHich is it? I need debug logs so I can guess where and why the crash happens. All I can see from above is that the capture stream closed and it deleted the VideoStore object and it all crashed.

shaun-ba commented 5 years ago

@connortechnology Yes, just this one, you asked for more logs but this is all I have. I can't go back and get them if I don't have debugging on for that component, so which component is it you need them for?

I post more issues that anyone here, 75% being genuine bugs so I wouldn't treat my reports as a chore as I'm trying to aid in making the software more stable.

shaun-ba commented 5 years ago

@connortechnology Found some more logs in ZMC debug logs:

10/01/18 08:17:07.344740 zmc_m3[10478].INF-zm_ffmpeg_camera.cpp/710 [Unable to read packet from stream 0: error -541478725 "End of file".]
10/01/18 08:17:07.344775 zmc_m3[10478].INF-zm_monitor.cpp/2387 [Return from Capture (-1), signal loss]
10/01/18 08:17:07.346397 zmc_m3[10478].INF-zmc.cpp/311 [Failed to capture image from monitor 3 (1/1)]
10/01/18 08:17:07.350545 zmc_m3[10478].DB1-zm_videostore.cpp/388 [Have audio encoder, need to flush it's out]
10/01/18 08:17:07.350835 zmc_m3[10478].DB1-zm_videostore.cpp/388 [Have audio encoder, need to flush it's out]
10/01/18 08:17:07.350857 zmc_m3[10478].DB1-zm_videostore.cpp/388 [Have audio encoder, need to flush it's out]
10/01/18 08:17:07.350867 zmc_m3[10478].DB1-zm_videostore.cpp/414 [Flushing interleaved queues]
10/01/18 08:17:07.351408 zmc_m3[10478].DB1-zm_videostore.cpp/417 [Writing trailer]
10/01/18 08:17:07.352331 zmc_m3[10478].INF-zm_ffmpeg_camera.cpp/163 [Priming capture from rtsp://192.168.1.155//Streaming/Channels/1]
10/01/18 08:17:07.352353 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/344 [Calling avformat_open_input for rtsp://192.168.1.155//Streaming/Channels/1]
10/01/18 08:17:07.513460 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/376 [Opened input]
10/01/18 08:17:07.513486 zmc_m3[10478].INF-zm_ffmpeg_camera.cpp/378 [Stream open rtsp://192.168.1.155//Streaming/Channels/1, parsing streams...]
10/01/18 08:17:10.370796 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/503 [Failed to find decoder (h264_mmal)]
10/01/18 08:17:10.370832 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/514 [Video Found decoder h264]
10/01/18 08:17:10.370842 zmc_m3[10478].DB1-zm_ffmpeg.cpp/267 [Dumping stream index i(0) index(0)]
10/01/18 08:17:10.370849 zmc_m3[10478].DB1-zm_ffmpeg.cpp/272 [    Stream #0:0]
10/01/18 08:17:10.370856 zmc_m3[10478].DB1-zm_ffmpeg.cpp/280 [, frames:28, timebase: 1/90000]
10/01/18 08:17:10.370868 zmc_m3[10478].DB1-zm_ffmpeg.cpp/282 [: Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080]
10/01/18 08:17:10.370876 zmc_m3[10478].DB1-zm_ffmpeg.cpp/227 [25 fps, ]
10/01/18 08:17:10.370886 zmc_m3[10478].DB1-zm_ffmpeg.cpp/229 [90k stream tb numerator , ]
10/01/18 08:17:10.370893 zmc_m3[10478].DB1-zm_ffmpeg.cpp/227 [50 codec time base:]
10/01/18 08:17:10.370899 zmc_m3[10478].DB1-zm_ffmpeg.cpp/337 [
]
10/01/18 08:17:10.370905 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/521 [Calling avcodec_open2]
10/01/18 08:17:10.371597 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/544 [HWACCEL not in use]
10/01/18 08:17:10.371616 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/556 [Audio Found decoder]
10/01/18 08:17:10.371624 zmc_m3[10478].DB1-zm_ffmpeg.cpp/267 [Dumping stream index i(1) index(0)]
10/01/18 08:17:10.371630 zmc_m3[10478].DB1-zm_ffmpeg.cpp/272 [    Stream #0:1]
10/01/18 08:17:10.371636 zmc_m3[10478].DB1-zm_ffmpeg.cpp/280 [, frames:71, timebase: 1/8000]
10/01/18 08:17:10.371646 zmc_m3[10478].DB1-zm_ffmpeg.cpp/282 [: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s]
10/01/18 08:17:10.371653 zmc_m3[10478].DB1-zm_ffmpeg.cpp/337 [
]
10/01/18 08:17:10.371659 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/563 [Calling avcodec_open2]
10/01/18 08:17:10.371669 zmc_m3[10478].DB1-zm_ffmpeg_camera.cpp/600 [Calling sws_isSupportedInput]
10/01/18 08:17:10.372551 zmc_m3[10478].INF-zm_videostore.cpp/54 [Opening video storage stream /var/cache/zoneminder/events/3/2018-10-01/169432/169432-video.mp4 format: mp4]
10/01/18 08:17:10.373291 zmc_m3[10478].DB1-zm_videostore.cpp/609 [Audio out bit_rate (48000) sample_rate(8000) channels(1) fmt(8) layout(0) frame_size(1024)]
10/01/18 08:17:10.373309 zmc_m3[10478].DB1-zm_videostore.cpp/636 [Bad channel layout. Need to set it to mono (4).]
10/01/18 08:17:10.374368 zmc_m3[10478].DB1-zm_ffmpeg.cpp/267 [Dumping stream index i(0) index(0)]
10/01/18 08:17:10.374381 zmc_m3[10478].DB1-zm_ffmpeg.cpp/272 [    Stream #0:0]
10/01/18 08:17:10.374386 zmc_m3[10478].DB1-zm_ffmpeg.cpp/280 [, frames:0, timebase: 1/90000]
10/01/18 08:17:10.374403 zmc_m3[10478].DB1-zm_ffmpeg.cpp/282 [: Video: h264, yuvj420p(pc, bt709), 1920x1080, q=2-31]
10/01/18 08:17:10.374411 zmc_m3[10478].DB1-zm_ffmpeg.cpp/229 [90k stream tb numerator , ]
10/01/18 08:17:10.374419 zmc_m3[10478].DB1-zm_ffmpeg.cpp/227 [50 codec time base:]
10/01/18 08:17:10.374425 zmc_m3[10478].DB1-zm_ffmpeg.cpp/337 [
]
10/01/18 08:17:10.374430 zmc_m3[10478].DB1-zm_ffmpeg.cpp/267 [Dumping stream index i(1) index(0)]
10/01/18 08:17:10.374436 zmc_m3[10478].DB1-zm_ffmpeg.cpp/272 [    Stream #0:1]
10/01/18 08:17:10.374441 zmc_m3[10478].DB1-zm_ffmpeg.cpp/280 [, frames:0, timebase: 0/0]
10/01/18 08:17:10.374449 zmc_m3[10478].DB1-zm_ffmpeg.cpp/282 [: Audio: aac, 8000 Hz, 1 channels, fltp, 48 kb/s]
10/01/18 08:17:10.374455 zmc_m3[10478].DB1-zm_ffmpeg.cpp/337 [
]
10/01/18 08:17:10.473843 zmc_m3[10478].DB1-zm_videostore.cpp/939 [Not enough samples yet (320)]
10/01/18 08:17:10.506972 zmc_m3[10478].DB1-zm_videostore.cpp/939 [Not enough samples yet (640)]
10/01/18 08:17:10.540110 zmc_m3[10478].DB1-zm_videostore.cpp/939 [Not enough samples yet (960)]
10/01/18 08:17:10.573249 zmc_m3[10478].DB1-zm_videostore.cpp/743 [duration calc: pts(10800) - l
shaun-ba commented 5 years ago

@connortechnology I disabled the H264+ and I've not had any event drop outs so far, I'm not sure about the scrambling of footage yet as nobody has crossed the frame, but it may be useful to know.

I actually enabled H264+ as it decreases bandwidth and filesize by 50%, apparently it's close to H265. I did this to see if the scrambling of footage was related to bandwidth, but I now thing it's zoneminder related and nothing to do with bandwidth or WiFi.

shaun-ba commented 5 years ago

@connortechnology The scrambling of events, artefacts and such, only occur when Audio is enabled.

I have disabled audio on these cameras and I've checked 30minutes of footage with no issues so far, so I think it's safe to say that this is related to that.

connortechnology commented 5 years ago

I just noticed that I have a dahua camera that claims to be sending h264+ with audio.

Works perfectly for me. :)

That last debug trace shows me something that I was expected, which is 0/0 timebase. I had added a test for that, so I'm wondering if this is still an issue?

shaun-ba commented 5 years ago

@connortechnology Unless you've pushed a fix since 1.32.0 for this then all of my issues are still valid. I've tried my best to post as much information and logs as possible so maybe you can correlate something between the different issues.

If not please let me know exactly how I can help, because I've tried various debugging logs and such but nothing seems to flag up.

connortechnology commented 5 years ago

I just fixed an issue that turned up on ubuntu 1810 . Related to audio codec not working due to channel layout being incorrect...

Please try latest.