Skip to content

Commit fcb786c

Browse files
committed
Add readme for FFmpeg hardware
1 parent c56b2cd commit fcb786c

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

internal/ffmpeg/hardware/README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Hardware
2+
3+
You **DON'T** need hardware acceleration if:
4+
5+
- you not using [FFmpeg source](https://github.com/AlexxIT/go2rtc#source-ffmpeg)
6+
- you using only `#video=copy` for FFmpeg source
7+
- you using only `#audio=...` (any audio) transcoding for FFmpeg source
8+
9+
You **NEED** hardware acceleration if you using `#video=h264`, `#video=h265`, `#video=mjpeg` (video) transcoding.
10+
11+
## Important
12+
13+
- Acceleration is disabled by default because it can be unstable (it can be changed in future)
14+
- go2rtc can automatically detect supported hardware acceleration if enabled
15+
- go2rtc will enable hardware decoding only if hardware encoding supported
16+
- go2rtc will use the same GPU for decoder and encoder
17+
- Intel and AMD will switch to software decoder if input codec is not supported with hardware decoder
18+
- NVidia will fail if input codec is not supported with hardware decoder
19+
- Raspberry always uses software decoder
20+
21+
```yaml
22+
streams:
23+
# auto select hardware encoder
24+
camera1_hw: ffmpeg:rtsp://rtsp:[email protected]/av_stream/ch0#video=h264#hardware
25+
26+
# manual select hardware encoder (vaapi, cuda, v4l2m2m, dxva2, videotoolbox)
27+
camera1_vaapi: ffmpeg:rtsp://rtsp:[email protected]/av_stream/ch0#video=h264#hardware=vaapi
28+
```
29+
30+
## Docker and Hass Addon
31+
32+
There are two versions of the Docker container and Hass Add-on:
33+
34+
- Latest (alpine) support hardware acceleration for Intel iGPU (CPU with Graphics) and Raspberry.
35+
- Hardware (debian 12) support Intel iGPU, AMD GPU, NVidia GPU.
36+
37+
## Intel iGPU
38+
39+
**Supported on:** Windows binary, Linux binary, Docker, Hass Addon.
40+
41+
If you have Intel CPU Sandy Bridge (2011) with Graphics, you already have support hardware decoding/encoding for `AVC/H.264`.
42+
43+
If you have Intel CPU Skylake (2015) with Graphics, you already have support hardware decoding/encoding for `AVC/H.264`, `HEVC/H.265` and `MJPEG`.
44+
45+
Read more [here](https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding) and [here](https://en.wikipedia.org/wiki/Intel_Graphics_Technology#Capabilities_(GPU_video_acceleration)).
46+
47+
Linux and Docker:
48+
49+
- It may be important to have the latest version of the OS with the latest version of the Linux kernel. For example, on my **Debian 10 (kernel 4.19)** it did not work, but after update to **Debian 11 (kernel 5.10)** all was fine.
50+
- In case of troube check you have `/dev/dri/` folder on your host.
51+
52+
Docker users should add `--privileged` option to container for access to Hardware.
53+
54+
**PS.** Supported via [VAAPI](https://trac.ffmpeg.org/wiki/Hardware/VAAPI) engine on Linux and [DXVA2+QSV](https://trac.ffmpeg.org/wiki/Hardware/QuickSync) engine on Windows.
55+
56+
## AMD GPU
57+
58+
*I don't have the hardware for test support!!!*
59+
60+
**Supported on:** Linux binary, Docker, Hass Addon.
61+
62+
Docker users should install: `alexxit/go2rtc:master-hardware`. Docker users should add `--privileged` option to container for access to Hardware.
63+
64+
Hass Addon users should install **go2rtc master hardware** version.
65+
66+
**PS.** Supported via [VAAPI](https://trac.ffmpeg.org/wiki/Hardware/VAAPI) engine.
67+
68+
## NVidia GPU
69+
70+
**Supported on:** Windows binary, Linux binary, Docker.
71+
72+
Docker users should install: `alexxit/go2rtc:master-hardware`.
73+
74+
Read more [here](https://docs.frigate.video/configuration/hardware_acceleration) and [here](https://jellyfin.org/docs/general/administration/hardware-acceleration/#nvidia-hardware-acceleration-on-docker-linux).
75+
76+
**PS.** Supported via [CUDA](https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC) engine.
77+
78+
## Raspberry Pi 3
79+
80+
**Supported on:** Linux binary, Docker, Hass Addon.
81+
82+
I don't recommend using transcoding on the Raspberry Pi 3. It's extreamly slow, even with hardware acceleration. Also it may fail when transcoding 2K+ stream.
83+
84+
## Raspberry Pi 4
85+
86+
*I don't have the hardware for test support!!!*
87+
88+
**Supported on:** Linux binary, Docker, Hass Addon.
89+
90+
**PS.** Supported via [v4l2m2m](https://lalitm.com/hw-encoding-raspi/) engine.
91+
92+
## macOS
93+
94+
In my tests, transcoding is faster on the M1 CPU than on the M1 GPU. Transcoding time on M1 CPU better than any Intel iGPU and comparable to NVidia RTX 2070.
95+
96+
**PS.** Supported via [videotoolbox](https://trac.ffmpeg.org/wiki/HWAccelIntro#VideoToolbox) engine.
97+
98+
## Rockchip
99+
100+
- Important to use custom FFmpeg with Rockchip support from [@nyanmisaka](https://github.com/nyanmisaka/ffmpeg-rockchip)
101+
- Static binaries from [@MarcA711](https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/)
102+
- Important to have Linux kernel 5.10 or 6.1
103+
104+
**Tested**
105+
106+
- [Orange Pi 3B](https://www.armbian.com/orangepi3b/) with Armbian 6.1, support transcoding H264, H265, MJPEG

0 commit comments

Comments
 (0)