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

Sending audio stream makes camera unresponsive #98

Open
danobot opened this issue Nov 1, 2018 · 2 comments
Open

Sending audio stream makes camera unresponsive #98

danobot opened this issue Nov 1, 2018 · 2 comments

Comments

@danobot
Copy link

danobot commented Nov 1, 2018

I am sendnig some audio which plays fine on the camera, however I am then unable to send subsequent streams or query the API for information such as SD card capacity. This is the documentation I followed.

        this_camera = get_camera(call);
        file=call.data.get(ATTR_FILE);
        _LOGGER.info("Playing {} on {}".format(file,call.data[ATTR_ENTITY_ID]));
        # this_camera.play_wav(httptype='singlepart', path_file=file);
        result = this_camera.audio_send_stream(httptype='singlepart', channel=1, path_file=file, encode='MPEG2');
        _LOGGER.info(dir(result));
        return result == 'OK';

The audio_send_stream method does not return, which explains the symptoms.
Is there anything I am missing in my code? Do I have to close some stream manually?
Tried singlepart and multipart and had the same problem with the commented out attempt at play_wav.
The only way to send more audio is by rebooting the camera.

@danobot
Copy link
Author

danobot commented Nov 3, 2018

I am working on adding some more integrations to the Amcrest Camera component for Home Assistant. Any help would be appreciated in getting this resolved.
Have got the PTZ preset control working already, this is a blocker though as I cannot figure out what is wrong.

@aredon
Copy link

aredon commented Oct 3, 2023

I realize this is pretty obscure and old but I've been using this method to push audio to my camera and play a welcome home message for like 5 years now. I'm moving my setup over into home assistant (and trying to figure out how to move this script) I saw you asking around so here it is for posterity:

curl --limit-rate 8K \ -F "file=@/var/lib/sounds/welcome_home.al;type=Audio/G.711A" \ -H "Content-Type: Audio/G.711A" \ -m 5 \ http://USERNAME:PASSWORD@192.168.1.100:37779/cgi-bin/audio.cgi\?action\=postAudio\&httptype\=singlepart\&channel\=1

If memory serves I could only get it to play .al files. I forget where I learned that from. There was also an issue with the playback speed of the audio being quite messed up so some fancy command had to be used to edit the file. Unfortunately I've lost track of that too and will need to dig it back up...

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

2 participants