]> git.sesse.net Git - nageru-docs/blob - hardware.rst
Mesa is much less buggy now.
[nageru-docs] / hardware.rst
1 Hardware requirements
2 =====================
3
4 Nageru is designed to be as plug-and-play as possible, but by nature,
5 a software video mixer requires a certain amount of hardware with associated
6 drivers.
7
8 Working OpenGL
9 --------------
10
11 Nageru uses your computer's graphics processing unit (GPU) extensively,
12 through OpenGL. The use of the GPU is the reason why Nageru can deliver
13 high-quality (as in e.g. gamma-correct fades and high-quality scaling)
14 HD video without a monster CPU, but it also comes with certain caveats.
15
16 In particular, Nageru's use of multithreaded OpenGL trickles bugs in
17 some drivers. in general, Intel GPUs from the Haswell
18 generation and newer should work well with Nageru, although they may
19 see performance issues if you connect interlaced sources (since the
20 automatic deinterlacing applied requires a fair bit of computing power). NVIDIA's
21 proprietary drivers (occasionally known as nvidia-glx) are generally excellent
22 and should give few issues in this regard.
23
24 If you see Nageru dying with a message about “GL error”, or segfaulting with
25 the stack trace pointing into libGL.so, your first intuition should be to check
26 that you have the latest drivers for your GPU.
27
28
29 .. _digital-intermediate:
30
31 VA-API H.264 encoding (optional)
32 --------------------------------
33
34 Even on modern networks and with today's large SSDs, uncompressed HD video is a
35 bit unwieldy to send around (uncompressed 720p60 4:2:0 is about 79 MB/sec,
36 or 663 Mbit/sec). Nageru creates a high-bitrate H.264 stream of the finished
37 output as a sort of “digital intermediate” that can much easier be stored to disk
38 (for future editing or re-streaming) or sent to an encoder on another machine
39 for final streaming.
40
41 Although you can use software encoding through x264 for
42 the digital intermediate, it is generally preferred to use a hardware encoder
43 if it is available. Currently, VA-API is the only hardware encoding method
44 supported for encoding the digital intermediate, although Nageru might support
45 NVIDIA's NVENC at some point in the future. In particular, this means that
46 Intel Quick Sync Video (QSV), the hardware H.264 encoder present on all modern
47 Intel GPUs, is supported.
48
49 QSV is more than fast enough to keep up with 720p60 in
50 realtime without eating appreciably into the power budget, but it is not
51 competitive with the top H.264 encoders in terms of quality per bit. Also,
52 the stream is encoded using *constant quality* (fixed quantizer), not
53 constant bitrate, which means the bitrate will vary strongly with content.
54 (For practical material, the quantizer used by Nageru will end up around
55 25 Mbit/sec for 720p60, and be nearly visually lossless so as to allow
56 further editing or transcoding without strong generational loss.) Thus, the
57 QSV stream is not intended for streaming to end users of the Internet; it will
58 need to be reencoded by some external means, or you can use Nageru's x264
59 support to produce a user-facing stream in addition to the digital intermediate
60 (see :doc:`streaming`).
61
62 If possible, Nageru uses zerocopy from the GPU to the VA-API buffers in order to
63 reduce memory transfer bandwidth.
64
65
66 Video capture cards
67 -------------------
68
69 If you do not have enough cards to satisfy your theme when you start up
70 Nageru, *fake cards* will be instantiated. They produce a simple color
71 (depending on the card) and no audio (unless you give the --fake-cards-audio
72 command-line flag, in which case they will produce a tone). USB hotplug
73 is supported; once you insert a new card, it will automatically be detected
74 and takes the place of one of the fake cards.
75
76 Currently, Nageru supports only Blackmagic's capture cards; specifically,
77 it does not support Video4Linux. This may change in the future if cards
78 come along that significantly improve upon Blackmagic's lineup in terms
79 of features, price or stability. (Most other cards fail on all three counts.)
80
81 There are separate drivers for the USB and PCI cards. (Thunderbolt cards,
82 although rare, count as PCI cards in this respect.) The USB cards are
83 handled by a driver called *bmusb* that is built into Nageru; they require
84 working USB3 on your machine, but nothing else. (Kernel versions prior to
85 4.6 are not recommended, though. If you get USB issues, upgrade your kernel.)
86 The cards autodetect their input, but unfortunately has no 1080p60 support,
87 which means that most laptops plugged in will default to 1080i60, which
88 probably is not what you want. (In particular, the YADIF deinterlacer
89 employed by Nageru puts a lot of strain on the GPU; too much for most
90 Intel GPUs.)
91
92 The PCI cards (known as DeckLink) require Blackmagic's proprietary driver
93 (`Desktop Video <https://www.blackmagicdesign.com/support>`_) installed
94 and working. It is non-free and thus not included in most Linux distributions.
95 However, the SDK is not needed for building Nageru; the required headers
96 are free and included. Most of the PCI cards autodetect, but for some older
97 versions, you will need to right-click on the input to set the right mode.
98
99
100 Video format conversion
101 -----------------------
102
103 If you have an input source with a different resolution than the native mode
104 (720p by default, but you can change this using the -w and -h command line
105 parameters), Nageru will scale transparently for you using a Lanczos3
106 filter (or rather, the :doc:`theme <theme>` will). This requires some extra GPU power,
107 so if you can avoid it, use the native mode. Similarly, if you connect an
108 interlaced input, Nageru will automatically deinterlace for you.
109
110 Frame rates are automatically converted; one input is designated as the
111 **master clock** (right-click on an input to select it as such), and gets
112 to dictate the frame rate of the output. Inputs with differing frame rates
113 will get frames duplicated or dropped as needed (with adaptive queuing to
114 account for clock and jitter).
115
116 Nageru works in 16-bit floating-point RGBA internally. High-quality conversion to and
117 from subsampled Y'CbCr (typically 4:2:2 for inputs and 4:2:0 for outputs)
118 is done transparently on the GPU. Input and output is 8-bit Y'CbCr by default,
119 but be aware that 8-bit Y'CbCr, however common, cannot capture the full color
120 fidelity of 8-bit RGB (not to mention 10-bit RGB). If you have spare GPU power,
121 you can enable 10-bit Y'CbCr input and output with --10-bit (before Nageru 2.2.0,
122 you needed to use --10-bit-input and --10-bit-output as separate flags),
123 although you should be aware that client
124 support for 10-bit H.264 is very limited. Also, Quick Sync Video does not
125 support 10-bit H.264 encoding, so in this case, the digital intermediate needs
126 to be encoded in software.
127
128
129 Performance tips
130 ----------------
131
132 It is strongly recommended to have the rights to run at real-time priority;
133 it will make the USB3 threads do so, which will make them a lot more stable.
134 (A reasonable hack for testing is probably just to run it as root using sudo,
135 although you might not want to do that in production, but instead grant
136 your regular user permissions in /etc/security/limits.conf.) Note also that if you
137 are running a desktop compositor, it will steal significant amounts of GPU
138 performance. The same goes for PulseAudio.
139
140 Nageru tries to lock itself into RAM if it has the permissions to do
141 so, for better realtime behavior. (Writing the stream to disk tends to
142 fill the buffer cache, eventually paging less-used parts of Nageru out.)
143 Again, this is something you can set in limits.conf.