Changes between Version 62 and Version 63 of HWAccelIntro
- Timestamp:
- Jan 8, 2018, 10:39:10 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HWAccelIntro
v62 v63 1 [[PageOutline (2, Contents)]]1 [[PageOutline]] 2 2 3 3 Many platforms offer access to dedicated hardware to perform a range of video-related tasks. Using such hardware allows some operations like decoding, encoding or filtering to be completed faster or using less of other resources (particularly CPU), but may give different or inferior results, or impose additional restrictions which are not present when using software only. On PC-like platforms, video hardware is typically integrated into a GPU (from AMD, Intel or NVIDIA), while on mobile SoC-type platforms it is generally an independent IP core (many different vendors). … … 12 12 13 13 14 = = Platform API Availability ==14 = Platform API Availability = 15 15 16 16 || ||||||= Linux =||||||= Windows =||= Android =||||= Apple =||= Other =|| … … 32 32 33 33 Key: 34 * YFully usable.35 * PPartial support (some devices / some features).36 * NNot possible.34 * `Y` Fully usable. 35 * `P` Partial support (some devices / some features). 36 * `N` Not possible. 37 37 38 38 39 = = FFmpeg API Implementation Status ==39 = FFmpeg API Implementation Status = 40 40 41 41 || ||||||= Decoder =||||= Encoder =||||||= Other support =|| … … 58 58 59 59 Key: 60 * -Not applicable to this API.61 * YWorking.62 * NPossible but not implemented.63 * FNot yet integrated, but work is being done in this area.60 * `-` Not applicable to this API. 61 * `Y` Working. 62 * `N` Possible but not implemented. 63 * `F` Not yet integrated, but work is being done in this area. 64 64 65 65 66 = = Use with the FFmpeg Utility ==66 = Use with the `ffmpeg` command-line tool = 67 67 68 68 Internal hwaccel decoders are enabled via the `-hwaccel` option. The software decoder starts normally, but if it detects a stream which is decodable in hardware then it will attempt to delegate all significant processing to that hardware. If the stream is not decodable in hardware (for example, it is an unsupported codec or profile) then it will still be decoded in software automatically. If the hardware requires a particular device to function (or needs to distinguish between multiple devices, say if several graphics cards are available) then one can be selected using `-hwaccel_device`. … … 75 75 76 76 77 = = VDPAU ==77 = VDPAU = 78 78 79 [http ://http.download.nvidia.com/XFree86/vdpau/doxygen/html/index.html Video Decode and Presentation API for Unix]. Developed by NVIDIA forUnix/Linux systems. To enable this you typically need the `libvdpau` development package in your distribution, and a compatible graphics card.79 [https://http.download.nvidia.com/XFree86/vdpau/doxygen/html/index.html Video Decode and Presentation API for Unix]. Developed by NVIDIA for !Unix/Linux systems. To enable this you typically need the `libvdpau` development package in your distribution, and a compatible graphics card. 80 80 81 81 Note that VDPAU cannot be used to decode frames in memory, the compressed frames are sent by libavcodec to the GPU device supported by VDPAU and then the decoded image can be accessed using the VDPAU API. This is not done automatically by FFmpeg, but must be done at the application level (check for example the {{{ffmpeg_vdpau.c}}} file used by {{{ffmpeg.c}}}). Also, note that with this API it is not possible to move the decoded frame back to RAM, for example in case you need to encode again the decoded frame (e.g. when doing transcoding on a server). … … 83 83 Several decoders are currently supported through VDPAU in libavcodec, in particular H.264, MPEG-1/2/4, and VC-1. 84 84 85 = = VAAPI ==85 = VAAPI = 86 86 87 87 Video Acceleration API (VAAPI) is a non-proprietary and royalty-free open source software library ("libva") and API specification, initially developed by Intel but can be used in combination with other devices. … … 89 89 It can be used to access the Quick Sync hardware in Intel GPUs and the UVD/VCE hardware in AMD GPUs. See [wiki:Hardware/VAAPI VAAPI]. 90 90 91 = = DXVA2 ==91 = DXVA2 = 92 92 93 Direct-X Video Acceleration API, developed by Microsoft (supports Windows and XBox360). 94 95 Link to MSDN documentation: 96 http://msdn.microsoft.com/en-us/library/windows/desktop/cc307941%28v=vs.85%29.aspx 93 [https://msdn.microsoft.com/en-us/library/windows/desktop/cc307941(v=vs.85).aspx Direct-X Video Acceleration API], developed by Microsoft (supports Windows and XBox360). 97 94 98 95 Several decoders are currently supported, in particular H.264, MPEG-2, VC-1 and WMV 3. 99 96 100 97 DXVA2 hardware acceleration only works on Windows. In order to build FFmpeg with DXVA2 support, you need to install the dxva2api.h header. 101 For MinGW this can be done by [http ://download.videolan.org/pub/contrib/dxva2api.h downloading the header maintained by VLC] and installing it in the include patch (for example in {{{/usr/include/}}}).98 For MinGW this can be done by [https://download.videolan.org/pub/contrib/dxva2api.h downloading the header maintained by VLC] and installing it in the include patch (for example in {{{/usr/include/}}}). 102 99 103 100 For MinGW64, `dxva2api.h` is provided by default. One way to install mingw-w64 is through a {{{pacman}}} repository, and can be installed using one of the two following commands, depending on the architecture: … … 115 112 116 113 117 = = VideoToolbox ==114 = !VideoToolbox = 118 115 119 116 [https://developer.apple.com/documentation/videotoolbox VideoToolbox], only supported on macOS. H.264 decoding is available in FFmpeg/libavcodec. 120 117 121 = = NVENC ==118 = NVENC = 122 119 123 120 NVENC is an API developed by NVIDIA which enables the use of NVIDIA GPU cards to perform H.264 and HEVC encoding. FFmpeg supports NVENC through the {{{h264_nvenc}}} and {{{hevc_nvenc}}} encoders. In order to enable it in FFmpeg you need: … … 137 134 138 135 {{{ 139 #!div style="border: 1p t dotted; margin: 1em; background-color: #fffff9;"136 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 140 137 '''Note:''' If you get the {{{No NVENC capable devices found}}} error make sure you're encoding to a supported pixel format. See encoder info as shown above. 141 138 }}} 142 139 143 = = CUDA/CUVID/NvDecode ==140 = CUDA/CUVID/NvDecode = 144 141 145 142 CUVID, which is also called nvdec by NVIDIA now, can be used for decoding on Windows and Linux. … … 170 167 The {{{-hwaccel_device}}} option can be used to specify the GPU to be used by the cuvid hwaccel in ffmpeg. 171 168 172 = = libmfx ==169 = libmfx = 173 170 174 171 libmfx is a proprietary library from Intel for use of Quick Sync hardware on both Linux and Windows. On Windows it is the primary way to use more advanced functions beyond those accessible via DXVA2/D3D11VA, particularly encode. On Linux it has a very restricted feature set and is hard to use, but may be helpful for some use-cases desiring maximum throughput. … … 176 173 See [wiki:Hardware/QuickSync QuickSync]. 177 174 178 = = OpenCL ==175 = OpenCL = 179 176 180 177 [https://www.khronos.org/opencl/ OpenCL] can be used for a number of filters. To build, OpenCL 1.2 or later headers are required, along with an ICD or ICD loader to link to - it is recommended (but not required) to link with the ICD loader, so that the implementation can be chosen at run-time rather than build-time. At run-time, an OpenCL 1.2 driver is required - most GPU manufacturers will provide one as part of their standard drivers. CPU implementations are also usable, but may be slower than using native filters in ffmpeg directly. … … 187 184 * libmfx: NV12 surfaces only, via VAAPI or DXVA2. 188 185 189 = = AMD UVD/VCE ==186 = AMD UVD/VCE = 190 187 191 188 AMD UVD is usable for decode via VDPAU and VAAPI in Mesa on Linux. VCE also has some initial support for encode via VAAPI, but should be considered experimental. … … 193 190 On Windows, UVD is accessible via standard DXVA2/D3D11VA APIs, while VCE is supported via AMF. 194 191 195 = = External resources ==192 = External resources = 196 193 197 * http://multimedia.cx/eggs/mac-hwaccel-video/198 * http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/11691199 * http://stackoverflow.com/questions/23289157/how-to-use-hardware-acceleration-with-ffmpeg194 * [https://multimedia.cx/eggs/mac-hwaccel-video/ multimedia.cx: How To Play Hardware Accelerated Video on A Mac] 195 * [https://lists.ffmpeg.org/pipermail/libav-user/2013-September/005463.html libav-user: Hardware accelerated decoding] 196 * [https://stackoverflow.com/questions/23289157/how-to-use-hardware-acceleration-with-ffmpeg Stack Overflow: How to use hardware acceleration with ffmpeg]
