sahilchaddha / homebridge-dafang

Homebridge Plugin for Xiaomi Dafang / Wyze Cam IP Camera => Hey Siri, Start Video Recording
MIT License
204 stars 34 forks source link

[BUG] - No Audio in Home App #25

Closed renedivx closed 5 years ago

renedivx commented 5 years ago

Hello

if i start the Video Stream in Home App i dont have audio sound. If i start with mqtt audio recording i get a .avi file on raspberry where i can hear the audio. Also if i stream the rtsp stream directly with VLC i have audio.

My Dafang audio settings are: audio format: pcmu in rate 8000 out rate 8000 no filter volume max I try also other setiings, but nothing change.

my other problem is if i change in config audo to true, i dont get any livestream in the home app. if i delete "audio": true, complete in config, i also dint get the live steam. the live stream only works if i make "audio": to false. but than i never get audio sound.

i use a raspberry 3 with debian stretch.

i also look at homebridge ffmpeg plugin to find a solution, but nothing works for me.

here is my config

{ "platform": "Dafang", "mqtt": { "hostBroker": false, "port": 1883, "host": "192.168.22.104", "debug": true }, "cameras": [ { "cameraName": "terrasse", "cameraRTSPStreamUrl": "rtsp://192.168.22.69:8554/unicast", "mqttTopic": "haus/terrasse/#", "folder": "/home/pi/kamera/", "recordingDirectoryPathFormat": "DD-MM-YYYY", "recordingFilenameFormat": "DD-MM-YYYY-kk-mm-ss", "accessories": [ { "name": "Bewegungssensor", "type": "richMotionSensor", "threshold": 100000 }, { "name": "Auto Bewegung", "type": "autoMotionTrackingSwitch" }, { "name": "Nachtsichtsensor", "type": "nightVisionSensor", "threshold": 0 }, { "name": "Nachtsicht", "type": "nightVisionSwitch" }, { "name": "Auto Nachtsicht", "type": "autoNightVisionSwitch" }, { "name": "Links", "type": "moveCamera", "axis": "horizontal", "direction": "left" }, { "name": "Rechts", "type": "moveCamera", "axis": "horizontal", "direction": "right" }, { "name": "Hoch", "type": "moveCamera", "axis": "vertical", "direction": "up" }, { "name": "Runter", "type": "moveCamera", "axis": "vertical", "direction": "down" }, { "name": "Video aufnehmen", "type": "recordVideo" }, { "name": "Audio aufnehmen", "type": "recordAudio" }, { "name": "Bild aufnehmen", "type": "captureImage" }, { "name": "RPi Speicher", "type": "storageSensor" }, { "name": "Speicher bereinigen", "type": "clearStorage" }, { "name": "Stream zurücksetzen", "type": "resetFFMPEG" }, { "name": "Helligkeit", "type": "brightness" }, { "name": "Neustarten", "type": "restartSwitch" }, { "name": "Kalibrieren", "type": "recalibrateSwitch" } ], "videoConfig": { "source": "-rtsp_transport tcp -re -i rtsp://192.168.22.69:8554/unicast", "stillImageSource": "-i http://root:ismart12@192.168.22.69/cgi-bin/currentpic.cgi", "maxStreams": 2, "maxWidth": 1280, "maxHeight": 720, "maxFPS": 21, "maxBitrate": 299, "vcodec": "h264_omx", "audio": true, "packetSize": 188 } } ] },

thanks for your help best regards rene

renedivx commented 5 years ago

This solves my problem

install build tools

sudo apt-get install pkg-config autoconf automake libtool libx264-dev

download and build fdk-aac

git clone https://github.com/mstorsjo/fdk-aac.git cd fdk-aac ./autogen.sh ./configure --prefix=/usr/local --enable-shared --enable-static make -j4 sudo make install sudo ldconfig cd ..

download and build ffmpeg

git clone https://github.com/FFmpeg/FFmpeg.git cd FFmpeg ./configure --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp make -j4 sudo make install

renedivx commented 5 years ago

Now i have until this a other problem. I cant save videos files anymore. They tart recording and makes every two seconds a new mp4 file. but all files have 0 byte.

Before i install ffmpeg new like last reply i dont have this problem. Any idea?

renedivx commented 5 years ago

Change Audio Type in dafang Settings to MP§ solve my Porblem. Now all is working.

mkormendy commented 4 years ago

For anyone coming across this, and trying to get audio working on MacOS with homebrew, you need to make sure that ffmpeg is compiled with fdk-aac beforehand, but the options have been removed from the ffmpeg install formula.

I followed this https://github.com/justinmayer/homebrew-tap along with these options:

brew install justinmayer/tap/ffmpeg --with-chromaprint --with-fdk-aac --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rtmpdump --with-rubberband --with-webp --with-zeromq --with-zimg --with-srt --with-libvmaf

Then for the configuration...

On DAFANG: Video Size: 1280x720 Video Format: VBR Bitrate: 1200 Framerate: 30fps Audio Format: MP3 Sample Rate in/out: 16000/16000 Filter: no High pass: deselected AEC: deselected

In the config section for the dafang plugin in Homebridge:

"videoConfig": {
  "source": "-re -i rtsp://192.168.2.223:8554/unicast",
  "stillImageSource": "-i rtsp://192.168.2.223:8554/unicast -vframes 1 -r 1",
  "maxStreams": 2,
  "maxWidth": 1280,
  "maxHeight": 720,
  "maxFPS": 30,
  "audio": true
}