Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound events aren't recorded & On detection: invalid msg 0x6004 #831

Open
DrioQio opened this issue Feb 28, 2024 · 16 comments
Open

Sound events aren't recorded & On detection: invalid msg 0x6004 #831

DrioQio opened this issue Feb 28, 2024 · 16 comments

Comments

@DrioQio
Copy link

DrioQio commented Feb 28, 2024

I have problems with the sound event detection. No video is recorded when there are abnormally loud noises. The motion events work reliably.

Because of the problem, I searched for similar posts and looked at the outputs of your ipc_multiplex.so.
I noticed that sound events are always logged as "invalid msg 0x6004":

dispatch.c(do_mq_process-4179)[19:08:20.636]:invalid msg 0x6004
dispatch.c(do_mq_process-4179)[19:08:21.640]:invalid msg 0x1007
dispatch.c(do_mq_process-4179)[19:25:02.679]:invalid msg 0x6004
dispatch.c(do_mq_process-4179)[19:25:03.176]:invalid msg 0x1007

Motion events are always named and assigned:

dispatch.c(do_mq_process-2604)[19:05:28.159]:g_dispatch_info.mmap_info->motion_type  =0
dispatch.c(do_mq_process-4179)[19:05:28.233]:invalid msg 0x1007
dispatch.c(do_mq_process-2604)[19:10:13.200]:g_dispatch_info.mmap_info->motion_type  =0
dispatch.c(do_mq_process-4179)[19:10:13.943]:invalid msg 0x1007

Is this a normal behavior?

@roleoroleo
Copy link
Owner

roleoroleo commented Feb 29, 2024

The log you see is related to dispatch process: a Yi process.
ipc_multiplex doesn't check the type of message, simply it reads the messages from the main queue and repeats them on other message queues.

Which type of audio codec are yuo using for rtsp?

@DrioQio
Copy link
Author

DrioQio commented Feb 29, 2024

I had disabled the RTPS stream. But I just turned it on now for testing (stream resolution: low). Tested with the audio codecs pcm, alaw, ulaw, acc but unfortunately there is no improvement.

Should I perhaps test something else?

@roleoroleo
Copy link
Owner

What's your model suffix?
When a motion is detected, is there audio in the recorded files?

@DrioQio
Copy link
Author

DrioQio commented Mar 2, 2024

Sorry, it is a r35gb, YRS, 12.1.47.

Yes, if a motion was detected, there is sound in the video.
When I had previously installed the YI app, events of loud noises were also displayed in the app and videos were recorded from them.

@Dotatay
Copy link

Dotatay commented Mar 4, 2024

Hello and excuse me for the off-topic. I also have a Dome Guard but an older one r30gb and also problems with the sound. Can you please tell me how I can start this log? When I run "ipc_read -n 9" I only get @ signs and no code number, motion or sound messages.

@DrioQio
Copy link
Author

DrioQio commented Mar 5, 2024

@Dotatay
Caution, this is not the recommended procedure and mistakes in the lower_half_init.sh may potentially cause damage.

Edit in your SD card root the file: lower_half_init.sh.
Search the line LD_PRELOAD=/tmp/sd/yi-hack/lib/ipc_multiplex.so ./dispatch & and replace it with LD_PRELOAD=/tmp/sd/yi-hack/lib/ipc_multiplex.so ./dispatch > /tmp/sd/camlog.txt 2>&1 &
After a reboot it creates in your SD card root the file: camlog.txt

@roleoroleo
Copy link
Owner

You should try to sniff the ipc messages.

ipc_sniff.gz
./ipc_sniff ipc_dispatch_3
and check if the "sound detected" message appears.
The message is:
#define IPC_SOUND_DETECTION "\x04\x00\x00\x00\x02\x00\x00\x00\x04\x60\x04\x60\x00\x00\x00\x00"

Pay attention: the sound detection algorithm checks an abnormal sound. If you have a very loud environment the cam will not detect a sound, you need loud sound in quiet environment.

@DrioQio
Copy link
Author

DrioQio commented Mar 18, 2024

The output from ipc_sniff was not easy to understand, but now I have found the correct values that can be reproduced consistently. But the "\x" characters are not present.

./ipc_sniff ipc_dispatch_3
Sound:

IPC message. Len: 16. Status: No error information!
Parsing message.
04 00 00 00 02 00 00 00 04 60 04 60 00 00 00 00 

Motion:

IPC message. Len: 16. Status: No error information!
Parsing message.
01 00 00 00 02 00 00 00 7c 00 7c 00 00 00 00 00 

When running ./ipc_read -n 3, I only get @ symbols, as Dotatay reported.

./ipc_read -n 3
Motion:

@

@



@



@


@

@

@roleoroleo
Copy link
Owner

The output from ipc_sniff was not easy to understand, but now I have found the correct values that can be reproduced consistently. But the "\x" characters are not present.

Yes, it's correct. \x is the prefix for hexadecimal format.

04 00 00 00 02 00 00 00 04 60 04 60 00 00 00 00

And this is the message related to the sound detection, so detection is working.
You should try to disable temporarily the hack (removing the sd card) and check if recording works.

When running ./ipc_read -n 3, I only get @ symbols, as Dotatay reported.

Use -d option.

@DrioQio
Copy link
Author

DrioQio commented Mar 26, 2024

You should try to disable temporarily the hack (removing the sd card) and check if recording works.

Without SD card, sound and motion events are recorded.

Use -d option.

With the -d option, the outputs are similar to ipc_sniff:
04 00 00 00 02 00 00 00 04 60 04 60 00 00 00 00 and 01 00 00 00 02 00 00 00 7c 00 7c 00 00 00 00 00

I thought that text messages ("MOTION_START") would have to be output like in the webhook-script by ivanfor:
roleoroleo/yi-hack-Allwinner#257 (comment)

@roleoroleo
Copy link
Owner

Up...

@Dotatay
Copy link

Dotatay commented Apr 5, 2024

With the examples and commands from above, I get the same results.
My Camera Dome Guard r30gb YRS 9.0.05 with ethernet and yi-hack-Allwinner-v2 0.3.1

@roleoroleo
Copy link
Owner

I'm checking it but this task requires a lot of time.
Please, be patience.

@roleoroleo
Copy link
Owner

After some further investigation I was able to reproduce the problem.
This is the behavior of my cam.

If cloud is enabled, when I play a loud sound, the cam detects the event and send the notification to the cloud.
I can see the video with the app but if I check the folder /tmp/sd/record, no files are saved.
The MQTT broker receives the message from the cam.

If cloud is disabled, when I play a loud sound, the cam detects the event but it can't send the notification to the cloud.
I can't use the app and if I check the folder /tmp/sd/record, no files are saved.
The MQTT broker receives the message from the cam.

The only explanation is that the video is recorded by the cloud.

@Dotatay
Copy link

Dotatay commented May 24, 2024

Sorry for the late reply. If I remove the hack-SD from my r30gb and replace it with a yi-app formatted SD. Then are sound event videos also recorded onto the SD.

@roleoroleo
Copy link
Owner

Ok, test in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants