mnakada / atomcam_tools

Hack tool for atomcam and wyzecam.
Other
183 stars 22 forks source link

audio playing support #55

Closed thematrixdev closed 1 year ago

thematrixdev commented 2 years ago

It seems I have seen audio (file) playing is supported? May I know how to do it? Thanks.

mnakada commented 2 years ago

The following command will play a wav file. It is better to put the wav files on SD-Card.

usage:
   /scripts/cmd aplay <wav file> <volume>

ex.:
[root@atomswing:~]# /scripts/cmd aplay /system/init/alarm.wav 20
thematrixdev commented 2 years ago

I have tried but it shows an error:

# /scripts/cmd aplay /media/mmc/door_unlocked.wav 20
error
thematrixdev commented 2 years ago
[root@atom-desk:mmc]# pwd
/media/mmc
[root@atom-desk:mmc]# ls -la
drwxrwxrwx    7 root     root          8192 Aug 23 10:26 .
drwxr-xr-x    3 root     root          1024 Jan  1  1970 ..
-rwxrwxrwx    1 root     root          8192 Jan  1  1980 FSCK0000.REC
drwxrwxrwx    2 root     root          8192 Jun 12 15:04 abnormal_log
-rwxrwxrwx    1 root     root        145049 Aug 23 10:10 atomhack.log
-rwxrwxrwx    1 root     root           102 May 18 09:05 authorized_keys
-rwxrwxrwx    1 root     root       1048576 Aug 21 21:06 configs
-rwxrwxrwx    1 root     root        107214 Aug 23 10:25 door_unlocked.wav
-rwxrwxrwx    1 root     root       2385935 Jan  1  1980 factory_t31_ZMC6tiIDQN
-rwxrwxrwx    1 root     root          1140 Aug  7 16:32 hack.ini
-rwxrwxrwx    1 root     root        741842 Aug 23 10:29 healthcheck.log
-rwxrwxrwx    1 root     root            10 May 18 09:06 hostname
-rwxrwxrwx    1 root     root             0 Aug  7 16:32 local_schedule
drwxrwxrwx    2 root     root          8192 Aug 22 21:03 log
-rwxrwxrwx    1 root     root     134217728 Aug 23 10:27 rootfs_hack.ext2
-rwxrwxrwx    1 root     root     134217728 Jan  1  1970 swap
-rwxrwxrwx    1 root     root            20 Aug 23 10:27 time.ini
drwxrwxrwx    2 root     root          8192 May 18 09:08 time_lapse
drwxrwxrwx    2 root     root          8192 Jan  1  1980 tmp
drwxrwxrwx    2 root     root          8192 Jan  1  1980 update
mnakada commented 2 years ago

It is not transcoded, so any format other than 16bit/mono/PCM/8KHz will result in an error. See https://github.com/mnakada/atomcam_tools/issues/23

thematrixdev commented 2 years ago

The camera fails to play the file output by this command:

ffmpeg -i 50af4ceaa70ff63abd84d19ff388952f24088ddc_zh-hk_a9c18110b0_cloud.mp3 -acodec pcm_s16le -ar 8000 -ac 1 door_unlocked.wav

Screenshot from 2022-08-23 11-09-28

The file could be played when converted by VLC player.

image

Confused.

mnakada commented 2 years ago

Modify the part of /scripts/atom_init.sh that executes iCamera_app to log stderr to a file as follows and restart it.

LD_PRELOAD=/tmp/system/lib/modules/libcallback.so /system/bin/iCamera_app >> /var/run/atomapp 2> /tmp/log/atomerr.log  &

Play the wav file and check /tmp/log/atomerr.log.

Check the following file for the part that checks for errors. https://github.com/mnakada/atomcam_tools/blob/main/libcallback/audio_play.c

gtxaspec commented 2 years ago

@mnakada I was not able to produce working files that could play via audio_play.c, without modification.

What I had to do was remove the code that checks for the wav header.

see https://github.com/gtxaspec/libcallback/blob/master/audio_play.c

Then files play properly (16bit/mono/PCM/8KHz)

mnakada commented 2 years ago

@gtxaspec ,Thanks. I will check.

mnakada commented 1 year ago

I have fixed it since Ver. 1.5.5.

mnakada commented 1 year ago

close this issue.