H.264 Video In Front End

I have a couple of security cameras around my house that can output a H.264 video stream. For security purposes, these cameras are not globally accessible (on my private home network only), but HA provides a great frontend to display current conditions. Unfortunately, I’m running HA on a Raspberry Pi 3, and the ffmpeg camera component keeps trying to convert all of my video streams to mjpeg to display in HA, which pretty much kills performance. Looking at the code (https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/camera/ffmpeg.py) it appears to only support mjpeg output, but I’m curious if we could use H.264 instead, which might allow use of the hardware acceleration, or even just a straight retransmission of the original video stream without any encoding action.

1 Like

I wonder if one of the other camera components like foscam might be a better base for you.

Unfortunately it looks like all of the camera components are designed to work with JPEG or MJPEG feeds, with the exception of the ffmpeg component which just does a behind the scenes conversion from whatever the source is to MJPEG, for displaying on the frontend.

I might have some time this weekend to look at this, but not sure how far I’ll get myself.

After posting I actually looked at the code and it does look that way.

+1, this would be a great feature!

Retransmitting an RTSP stream would be a great way to integrate HA with cameras such as the Xiaofang without putting too much work on the CPU.

I have got a Chinese camera and cannot set it up with HA I keep getting 400 not found when I try access the stream by going to the ip address of the camera.

Can anyone help please?

Thanks.

It’s been awhile since anyone brought this up, but I just discovered this issue and would like to second the request for H.264 video or an RTSP stream option. The MJPEG output is simply too substantial for a RPI3-driven front end to decode.

This is one of those upgrades that people who don’t understand video will not know they need, but literally EVERYONE that uses HA for video surveillance of any type will immediately benefit from!

I wish I could help because this is literally the feature that I want the most right now, but unfortunately I don’t have the coding chops to do it.

Heck, I would literally consider paying someone if they could develop this!

I agree. H.264 or rtps in state of the art nowadays. FFMPEG can handle H.264-streams without any problem but it needed to be implemented in HA in order to see the stream over HA.

If you think also on the possibility to do motion detection with ffmpeg an integrate this with some automation rules it will be of a great use.
Since now ffmpeg wil have to convert the h.264-stream to MJPEG and then perform the motion detection on top an the resource consumption even for a mac mini is an absolutely no go.
I quess that a RPi3 couldn’t handle it completely.

I guess there is no need to transcode it. Can this be implemented?


or

this would be a much needed feature, wondering why it hasn’t got any traction

1 Like

Any news about implementation ?

Anything here?

My understanding is that “stream” component will take your Camera’s RTSP H.264 feed and mux into an HLS formatted stream (containing the H.264 video) and send it to your browser and several browsers support HLS.

I doubt this helps very much but I found this topic after trying to figure out how to stream H.264 from BlueIris to HA. The best guide I could find was this one which shows how to embed the BlueIris UI3 web pages into HA. But - those pages are open source and leverage the browsers native players and they work w/o any lag. So they might be a useful starting point for someone: Home Assistant - Better Blue Iris Integration using Lovelace iframes