fluidd-core / FluiddPI

FluiddPi - A Pi image with Klipper, Moonraker, Fluidd and Web Camera support pre-installed.
https://docs.fluidd.xyz
GNU General Public License v3.0
299 stars 58 forks source link

Integrate Fmp4streamer for built in H264 HTML video #51

Open ChaosBlades opened 2 years ago

ChaosBlades commented 2 years ago

Fmp4streamer streams your V4L2 camera directly to any browser and media player as H264 inside fragmented mp4. It is compatible with desktops and mobiles. You can add it your phone's home screen too!

https://github.com/soyersoyer/fmp4streamer

How does it work?

Fmp4streamer setups the V4L2 device, reads the H264 or MJPGH264 stream from it (or the YUYV, MJPG stream and converts to H264 with a M2M V4L2 device), adds MP4 header (fragmented mp4 - fmp4) and serves it via HTTP. On the browser side it works with only one html5 video tag, no js needed. It's pretty lightweight.

Did some testing with this and you can't use it directly loaded on FluidPi. All you get instead of video on the camera view is another instance of Fluidd no matter the port you use. I am able to view the stream loaded on FluidPi in a separate browser tab however. It has to be from a separate IP address and that way it works extremely well. No more bandwidth constraints trying to push a huge MJPG stream.

It also uses barely any CPU or Memory as all the heavy lifting is done on the GPU which we don't use anyways except maybe KlipperScreen. It is so light weight it works on the original Pi Zero.

You can view the specific capabilities of the attached cameras with v4l2-ctl --list-formats-ext