mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.65k stars 168 forks source link

Feature request: Add documentation for preferred ffmpeg flags #495

Open tensiondriven opened 2 years ago

tensiondriven commented 2 years ago

Love the project - I thought that Bridge might be able to borrow a trick from Frigate, which is an NVR project with HomeAssistant integration. Frigate does a ton of CPU/GPU/TPU work and as such needs to be efficient with its video pipelines. The frigate documentation lists several sets of flags for ffmpeg to optimize performance based on various Intel CPU architectures and GPU configurations.

I think these flags would also work with Bridge, and wanted to raise if it would make sense to update the Readme/Wiki to include instructions for passing optimal flags to ffmpeg, similar to how Frigate provides such documentation. I don't think there would be any code changes needed, and using these flags might alleviate some of the performance issues people have reported.

Just wanted to share the idea, feel free to close as won't-fix if I'm off base.

mrlt8 commented 2 years ago

Unlike frigate, the bridge doesn't actually decode/encode any h264 with the default settings since we use -c:v copy and just pipe the stream from the cameras to the rtsp-simple-server, which should be more efficient than any HW based re-encoding.

However, any of the rotation options will require the video to be re-encoded, so that is one area where HW acceleration could potentially help. Not sure if snapshots could also take advantage of HW acceleration too since the stream has to be decoded to capture a frame for that.

I am open to the idea, but I think we'd need to find or compile our own static build of ffmpeg with HW acceleration enabled.

We're currently using the ffmpeg builds from https://github.com/homebridge/ffmpeg-for-homebridge, so maybe we could branch off that and enable the HW acceleration flags?