Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
add ffmpeg-for-homebridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandawg93 committed Mar 19, 2020
1 parent fa2a4dc commit 29349a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ View your Nest cams in HomeKit using [Homebridge](https://github.com/nfarina/hom
[![NPM](https://nodei.co/npm/homebridge-nest-cam2.png?compact=true)](https://nodei.co/npm/homebridge-nest-cam2/)

[![PayPal](https://img.shields.io/badge/paypal-donate-yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=CEYYGVB7ZZ764&item_name=homebridge-nest-cam2&currency_code=USD&source=url)
[![Discord](https://img.shields.io/discord/681137725071425676)](https://discord.gg/E6dnwsE)
[![Discord](https://img.shields.io/discord/432663330281226270)](https://discord.gg/pc2pqmh)
[![Downloads](https://img.shields.io/npm/dt/homebridge-nest-cam2)](https://nodei.co/npm/homebridge-nest-cam2/)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/df36db66217e4b96bd5994b42a6e27f2)](https://www.codacy.com/manual/Brandawg93/homebridge-nest-cam2?utm_source=github.com&utm_medium=referral&utm_content=Brandawg93/homebridge-nest-cam2&utm_campaign=Badge_Grade)

Expand Down Expand Up @@ -88,7 +88,7 @@ Extra options can be enabled/disabled depending on which switches and sensors yo
- streamingSwitch: enable/disable the ability to turn the camera on or off

## Join the Discord
Unfortunately, there is no way for me to test every subscription, camera type, and feature. If you would like to help me test new features and enhancements, join the [Discord Server](https://discord.gg/E6dnwsE) and let me know what you would like to test. Also, if you have general questions or support, feel free to [ask in the server](https://discord.gg/e7bPJnJ).
Unfortunately, there is no way for me to test every subscription, camera type, and feature. If you would like to help me test new features and enhancements, or if you have general questions or need support, join the official [Homebridge Discord Server](https://discord.gg/pc2pqmh).

## Credits
This plugin was derived from [homebridge-nest-cam](https://github.com/KhaosT/homebridge-nest-cam) with the new google authentication from [homebridge-nest](https://github.com/chrisjshull/homebridge-nest).
Expand Down
7 changes: 5 additions & 2 deletions lib/streamer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const PBF = require('pbf');
const EventEmitter = require('events');
const ip = require('ip');
const spawn = require('child_process').spawn;
var pathToFfmpeg = require('ffmpeg-for-homebridge');

const StreamProfile = require('./protos/PlaybackBegin.js').StreamProfile;
const PlaybackPacket = require('./protos/PlaybackPacket.js').PlaybackPacket;
Expand Down Expand Up @@ -435,8 +436,10 @@ class NexusStreamer extends EventEmitter {
let ffmpegCommand = '-use_wallclock_as_timestamps 1 -i - -c:v ' + self.ffmpegCodec + ' -an -pix_fmt yuv420p ' + x264Params + '-payload_type 99 -ssrc ' + videoSsrc + ' -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ' + videoKey.toString('base64') + ' srtp://'+targetAddress+':' + targetVideoPort+'?rtcpport='+targetVideoPort+'&localrtcpport='+targetVideoPort+'&pkt_size=1316';
//audio - https://github.com/KhaosT/homebridge-camera-ffmpeg/issues/9
//ffmpegCommand += ' -c:a libfdk_aac -profile:a aac_eld -vn -ac 1 -ar 16000 -b:a 8000 -flags +global_header -payload_type 110 -ssrc ' + audioSsrc + ' -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params '+audioKey.toString('base64')+' -rtsp_transport tcp srtp://'+targetAddress+':'+targetAudioPort+'?rtcpport='+targetAudioPort+'&localrtcpport='+targetAudioPort+'&pkt_size=188';

let ffmpeg = spawn('ffmpeg', ffmpegCommand.split(' '), {env: process.env});
if (typeof pathToFfmpeg === void 0) {
pathToFfmpeg = 'ffmpeg';
}
let ffmpeg = spawn(pathToFfmpeg, ffmpegCommand.split(' '), {env: process.env});
ffmpeg.stdin.on('error', (e) => {
if (e.code !== 'EPIPE') {
self.log.error(e.code);
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-nest-cam2",
"version": "1.1.7",
"version": "1.1.8",
"description": "Nest cam plugin for homebridge: https://homebridge.io/",
"license": "ISC",
"keywords": [
Expand All @@ -20,7 +20,8 @@
"dependencies": {
"ip": "^1.1.3",
"pbf": "^3.1.0",
"axios": "^0.19.2"
"axios": "^0.19.2",
"ffmpeg-for-homebridge": "^0.0.3"
},
"devDependencies": {
"eslint": "^6.8.0"
Expand Down

0 comments on commit 29349a5

Please sign in to comment.