mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Adding go2rtc presets for Rockchip hardware acceleration (#8686)
* add go2rtc presets for rk hw accel * code formatting * add docs about go2rtc presets * Update comment
This commit is contained in:
		
							parent
							
								
									463865db55
								
							
						
					
					
						commit
						1eb5105b24
					
				@ -113,6 +113,20 @@ if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) < 59:
 | 
			
		||||
            "rtsp"
 | 
			
		||||
        ] = "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
 | 
			
		||||
 | 
			
		||||
# add hardware acceleration presets for rockchip devices
 | 
			
		||||
# may be removed if frigate uses a go2rtc version that includes these presets
 | 
			
		||||
if go2rtc_config.get("ffmpeg") is None:
 | 
			
		||||
    go2rtc_config["ffmpeg"] = {
 | 
			
		||||
        "h264/rk": "-c:v h264_rkmpp_encoder -g 50 -bf 0",
 | 
			
		||||
        "h265/rk": "-c:v hevc_rkmpp_encoder -g 50 -bf 0",
 | 
			
		||||
    }
 | 
			
		||||
else:
 | 
			
		||||
    if go2rtc_config["ffmpeg"].get("h264/rk") is None:
 | 
			
		||||
        go2rtc_config["ffmpeg"]["h264/rk"] = "-c:v h264_rkmpp_encoder -g 50 -bf 0"
 | 
			
		||||
 | 
			
		||||
    if go2rtc_config["ffmpeg"].get("h265/rk") is None:
 | 
			
		||||
        go2rtc_config["ffmpeg"]["h265/rk"] = "-c:v hevc_rkmpp_encoder -g 50 -bf 0"
 | 
			
		||||
 | 
			
		||||
for name in go2rtc_config.get("streams", {}):
 | 
			
		||||
    stream = go2rtc_config["streams"][name]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -354,3 +354,29 @@ ffmpeg:
 | 
			
		||||
Make sure that your SoC supports hardware acceleration for your input stream. For example, if your camera streams with h265 encoding and a 4k resolution, your SoC must be able to de- and encode h265 with a 4k resolution or higher. If you are unsure whether your SoC meets the requirements, take a look at the datasheet.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
### go2rtc presets for hardware accelerated transcoding
 | 
			
		||||
 | 
			
		||||
If your input stream is to be transcoded using hardware acceleration, there are these presets for go2rtc: `h264/rk` and `h265/rk`. You can use them this way:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
go2rtc:
 | 
			
		||||
  streams:
 | 
			
		||||
    Cam_h264: ffmpeg:rtsp://username:password@192.168.1.123/av_stream/ch0#video=h264/rk
 | 
			
		||||
    Cam_h265: ffmpeg:rtsp://username:password@192.168.1.123/av_stream/ch0#video=h265/rk
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::warning
 | 
			
		||||
 | 
			
		||||
The go2rtc docs may suggest the following configuration:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
go2rtc:
 | 
			
		||||
  streams:
 | 
			
		||||
    Cam_h264: ffmpeg:rtsp://username:password@192.168.1.123/av_stream/ch0#video=h264#hardware=rk
 | 
			
		||||
    Cam_h265: ffmpeg:rtsp://username:password@192.168.1.123/av_stream/ch0#video=h265#hardware=rk
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
However, this does not currently work.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user