Code Monkey home page Code Monkey logo

Comments (13)

jmbwell avatar jmbwell commented on June 8, 2024

I've been testing this for a while, and it works pretty well with my UVC and G3 cameras and my all-current iOS devices. I don't have any older or newer cameras to test, or any iOS devices that for some reason might not support the non-transcoded video.

Still smooth sailing on your end as well? Has anyone else tried this?

On my system it cuts video start delay from about 10 seconds to about 5. Seems worth it.

from homebridge-camera-ffmpeg-ufv.

shnhrrsn avatar shnhrrsn commented on June 8, 2024

Yeah I haven’t run into any issues, testing on an iPhone XS, iPhone 8 and macOS Mojave.

I've been particularly interested in testing remote since I figure that's where the bitrate stuff comes into play. My HomePod is my hub for relaying, and I haven't run into quality issues except when cell service is super low where I don't think the bitrate would matter regardless.

from homebridge-camera-ffmpeg-ufv.

Botts85 avatar Botts85 commented on June 8, 2024

It's working really well here too.

I'm on the opposite side of @shnhrrsn though, as I am trying to maximize quality which simply remuxing the video helps achieve.

It also saves 30w every time I stream over homekit.

from homebridge-camera-ffmpeg-ufv.

rdougan avatar rdougan commented on June 8, 2024

@shnhrrsn I've been testing this out and it works great. I just run the Homebridge server on my iMac and streams generally start within 3-5 seconds. < 1s would be incredible, is possible!

from homebridge-camera-ffmpeg-ufv.

rdougan avatar rdougan commented on June 8, 2024

I should add that I have 3 G3 Flex and 1 G3 Micro cameras.

from homebridge-camera-ffmpeg-ufv.

shnhrrsn avatar shnhrrsn commented on June 8, 2024

Glad to hear this has been working out — I've opened a draft PR in #37 to start tracking this work.

Going to try to find some time this weekend to see if I can get it any quicker.

from homebridge-camera-ffmpeg-ufv.

rdougan avatar rdougan commented on June 8, 2024

I have very little experience with FFMpeg but one thought...

I've never been happy with a) how long it takes to open the Unifi app and view a camera and b) how slow the FFMpeg conversion is with HomeKit (although this helps significantly). I ended up making iOS, macOS and tvOS apps that use each camera /snapshot.jpeg and simply reloads that once a second.

Would it be possible to use FFMpeg to make a live stream from the snapshots, rather than using the RTSP live stream? Obviously, there would be no audio - but it would, in theory, be instant.

from homebridge-camera-ffmpeg-ufv.

shnhrrsn avatar shnhrrsn commented on June 8, 2024

It’s definitely possible but I’d be curious to know how much faster it actually is. I suspect more time is being spent launching ffmpeg than connecting to the RTSP feed so that overhead would still exist.

from homebridge-camera-ffmpeg-ufv.

rdougan avatar rdougan commented on June 8, 2024

I done a little testing and you are right, the initial launch of FFmpeg is the key problem with speed.

Perhaps it would be possible to just have FFmpeg constantly running in the background (where feasible)...

from homebridge-camera-ffmpeg-ufv.

ukypayne avatar ukypayne commented on June 8, 2024

Just added this to my setup. My Homebridge is running on an rPi 2 with 4 cams and this has helped tremendously. CPU usage is down 15-20% when viewing a stream compared to the out-of-the-box install of the ufv.js file.

from homebridge-camera-ffmpeg-ufv.

mdshw5 avatar mdshw5 commented on June 8, 2024
$ ffmpeg -rtsp_transport http -re -i rtsp://192.168.1.163:7447/5ce8a70ecf0416ebdcd3743e_0?apiKey= -threads 0 -vcodec libx264 -an -pix_fmt yuv420p -r 30 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -payload_type 99 -ssrc 2206678 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 6BLOAyn9DFy9fWjNW9KIV3I7aZM3xCAlwypavhBk srtp://192.168.1.214:60489?rtcpport=60489&localrtcpport=60489&pkt_size=1378
[1] 5703
[2] 5704
matt@homebridge:~$ ffmpeg version git-2019-07-18-ab4795a Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
  configuration: --prefix=/home/matt/ffmpeg_build --extra-cflags=-I/home/matt/ffmpeg_build/include --extra-ldflags=-L/home/matt/ffmpeg_build/lib --bindir=/home/matt/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-nonfree
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.102 / 58. 28.102
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.101 /  7. 56.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Unrecognized option 'tune'.
Error splitting the argument list: Option not found

It looks like the -tune parameter is private to specific ffmpeg encoders, and since we're using the copy encoder, my version of ffmpeg will not allow -tune zerolatency. I'll open a PR with this change.

from homebridge-camera-ffmpeg-ufv.

mdshw5 avatar mdshw5 commented on June 8, 2024

Nevermind. I installed the wrong branch from @shnhrrsn's PR. I'll give the "transmuxing" branch a shot and report back.

from homebridge-camera-ffmpeg-ufv.

extric99 avatar extric99 commented on June 8, 2024

I just wanted to say thanks for this optimisation.
i am running this plugin on an rPI 4 that host multiple virtual machines thanks to ESXi on Arm.
Without the optimisation i was at almost 100% for a single stream with 2 cpu cores assigned. After changing the code i dropped to max 3% which is incredible also because image quality went up.

from homebridge-camera-ffmpeg-ufv.

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.