Giter Club home page Giter Club logo

Comments (10)

Kane610 avatar Kane610 commented on September 26, 2024

It's on my list to investigate. I'm rewriting deconz integration right now. Then I'll solve some bugs with unifi then I hope to get back to the Axis integration

from axis.

WhistleMaster avatar WhistleMaster commented on September 26, 2024

Great news ! I would be happy to test and provide information if needed.

from axis.

Kane610 avatar Kane610 commented on September 26, 2024

Don't expect it to happen before summer though :/

I have too much to do which is the main issue

from axis.

WhistleMaster avatar WhistleMaster commented on September 26, 2024

Summer is the best time to test ;-) No worries !

from axis.

WhistleMaster avatar WhistleMaster commented on September 26, 2024

I'm doing some tests in the meanwhile and I can send sample sounds to the internal speaker with the following command:

ffmpeg -i <sound_file.mp3> -probesize 32 -analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 -ar 16000 -f wav -chunked_post 0 -content_type audio/axis-mulaw-128 "http://<user>:<password>@<cam_ip>/axis-cgi/audio/transmit.cgi"

from axis.

Kane610 avatar Kane610 commented on September 26, 2024

Oo wow! Awesome job.

from axis.

WhistleMaster avatar WhistleMaster commented on September 26, 2024

Thanks ! Just some good old google-fu to be honest 😇 nothing more.
I would like to help to implement that in your add-on but not sure if that really helps... It's a start but I guess that's something that should use some POST to send the sound file to the transmit.cgi and see it as a media_player entity.

from axis.

Kane610 avatar Kane610 commented on September 26, 2024

If you can just give me a proof of concept in python code I can formalize it afterwards

from axis.

WhistleMaster avatar WhistleMaster commented on September 26, 2024

I've tried to do something like that, as a PoC, which works fine:

import requests
from requests.auth import HTTPDigestAuth
from pydub import AudioSegment
from pydub.utils import mediainfo

# Set Auth
auth = HTTPDigestAuth("<USER>", "<PASSWORD>")

# Set the server URL
server_url = "http://<IP>/axis-cgi/audio/transmit.cgi"

# Open the MP3 file
input_file = AudioSegment.from_mp3("sound.mp3")

# Convert the MP3 file to WAV format
input_file = input_file.split_to_mono()[0]
input_file = input_file.set_frame_rate(16000)
input_file = input_file.export(
    "output.wav", format="wav", codec="pcm_mulaw", bitrate="128k")

# Print some info about the WAV
print(mediainfo("output.wav"))

# Read the WAV file and get its data
with open("output.wav", "rb") as f:
    file_data = f.read()

# Set the headers for the HTTP POST request
headers = {
    "Content-Type": "audio/axis-mulaw-128",
    "Content-Length": str(len(file_data)),
}

try:
    # Send the POST request with the file data and headers
    response = requests.post(server_url, data=file_data,
                             auth=auth, headers=headers)
    print(response.text)
    response.raise_for_status()
except requests.exceptions.HTTPError as errh:
    print("Http Error:", errh)
except requests.exceptions.ConnectionError as errc:
    print("Error Connecting:", errc)
except requests.exceptions.Timeout as errt:
    print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
    print("OOps: Something Else", err)

I've also found some documentation here: https://www.axis.com/vapix-library/subjects/t10100065/section/t10036015/display

from axis.

Kane610 avatar Kane610 commented on September 26, 2024

Sweet! I've taken my first small steps into the refactoring of the Axis library so once I'm further into that I can start looking at adding new things as it would be counterproductive to expand something that will be rewritten shortly after.

from axis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.