Transcode h265 to h264 “on the fly” for software NVR

I wonder if anyone has experience with transcoding h265+ to h264 in real-time?

I’m having an IP-cam that only outputs h265 that I would like to use for surveillance purposes. The camera is the latest-generation Annke C800 (I91BF).

I use a software NVR called Frigate (https://github.com/blakeblackshear/frigate) that detects motion in the sub-stream and performs object detection and record clips from the mainstream when a person is detected. No problems so far.

I use Frigate together with a home automation software (home assistant) which has a mobile phone application that notifies me when a person is detected.

I would like to be able to watch the recorded clips on my phone, which isn’t possible since they are saved in h265. I can watch the clips on my computer using VLC, and therefore I know that the clips are okay.

It is possible to set output args in Frigate, and I would like to use this to transcode the clips to h264. The default output args look like this(for a stream from a h264 camera):

-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an

After reaching out to the developer he suggested me to use the following args as a starting point:

-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an

These args work, but my CPU usage rose from around 4% to 90%+. The machine I’m using is an ASUS PN62 “NUC” with a 10th gen i5 processor. The output footage suffers from pretty significant compression artifacts along lines and when I check the properties of the recorded footage it suggests that they are filmed in 50 fps.

I tried some smaller changes to the args using the ffmpeg documentation, but I couldn’t really get my head around it.

I would like to achieve this without the excessive CPU-load and still output decent image quality. Would this be possible?

The camera is currently outputting an h.265+ stream of 2592×1944 pixels at 15fps with a maximum bitrate of 4096kbps and 32kbps AAC audio.

How could I change the output args to achieve this?

Im currently using the following args for hardware acceleration:

hwaccel_args:
– -hwaccel
– qsv
– -qsv_device
– /dev/dri/renderD128

Thanks!

Henrik

Answer

Attribution
Source : Link , Question Author : hankthetank , Answer Author : Community

Leave a Comment