Changes between Version 66 and Version 67 of HWAccelIntro


Ignore:
Timestamp:
Dec 31, 2018, 1:57:50 PM (4 months ago)
Author:
slhck
Comment:

update info on NVENC/NVDEC, mention two hwaccels, improvements welcome

Legend:

Unmodified
Added
Removed
Modified
  • HWAccelIntro

    v66 v67  
    1717|| ||= AMD =||= Intel =||= NVIDIA =||= AMD =||= Intel =||= NVIDIA =||= =||= macOS =||= iOS =||= Raspberry Pi =||
    1818||=                  AMF=|| N || N || N || **Y** || N || N || N || N || N || N ||
    19 ||= CUDA / CUVID / NVENC=|| N || N || **Y** || N || N || **Y** || N || N || N || N ||
     19||= NVENC/NVDEC/CUVID=|| N || N || **Y** || N || N || **Y** || N || N || N || N ||
    2020||=          Direct3D 11=|| N || N || N || **Y** || **Y** || **Y** || N || N || N || N ||
    2121||=   Direct3D 9 ^(DXVA2)^=|| N || N || N || **Y** || **Y** || **Y** || N || N || N || N ||
     
    4141|| || Internal || Standalone || Hardware output || Standalone || Hardware input || Filtering || Hardware context || Usable from ffmpeg CLI ||
    4242|| AMF                  || N || N || N || Y || Y || N || Y || Y ||
    43 || CUDA / CUVID / NVENC || N || Y || Y || Y || Y || Y || Y || Y ||
     43|| NVENC/NVDEC/CUVID || N || Y || Y || Y || Y || Y || Y || Y ||
    4444|| Direct3D 11          || Y || - || Y || - || - || F || Y || Y ||
    4545|| Direct3D 9 / DXVA2   || Y || - || Y || - || - || N || Y || Y ||
     
    115115[https://developer.apple.com/documentation/videotoolbox VideoToolbox], only supported on macOS. H.264 decoding is available in FFmpeg/libavcodec.
    116116
    117 = NVENC =
    118 
    119 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:
    120 
    121 * A supported GPU
     117= NVENC/NVDEC =
     118
     119NVENC and NVDEC are NVIDIA's hardware-accelerated encoding and decoding APIs. They used to be called CUVID. They can be used for encoding and decoding on Windows and Linux.
     120
     121== NVENC ==
     122
     123NVENC can be used for 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:
     124
     125* A [https://developer.nvidia.com/video-encode-decode-gpu-support-matrix supported GPU]
    122126* Supported drivers
    123 * {{{ffmpeg}}} configured without {{{--disable-nvenc}}}
     127* {{{ffmpeg}}} configured with {{{--enable-nvenc}}} (default if the drivers are detected while configuring)
    124128
    125129Check [https://developer.nvidia.com/nvidia-video-codec-sdk the NVIDIA website] for more info on the supported GPUs and drivers.
     
    143147}}}
    144148
    145 = CUDA/CUVID/NVDEC =
    146 
    147 CUVID, which is also called NVDEC by NVIDIA now, can be used for decoding on Windows and Linux.
    148 In combination with NVENC, it offers full hardware transcoding.
    149 
    150 CUVID offers decoders for H.264, HEVC, MJPEG, MPEG-1/2/4, VP8/VP9, VC-1.
    151 Codec support varies by hardware. The full set of codecs being available only on Pascal hardware, which adds VP9 and 10 bit support.
    152 
    153 Sample decode using CUVID, the cuvid decoder copies the frames to system memory in this case:
    154 {{{
    155 ffmpeg -c:v h264_cuvid -i input output.mkv
     149== NVDEC/CUVID ==
     150
     151NVDEC offers decoders for H.264, HEVC, MJPEG, MPEG-1/2/4, VP8/VP9, VC-1. Codec support varies by hardware (see the [https://developer.nvidia.com/video-encode-decode-gpu-support-matrix GPU compatibility table]).
     152
     153Note that FFmpeg offers both NVDEC and CUVID `hwaccel`s. They differ in how frames are decoded and forwarded in memory.
     154
     155The full set of codecs being available only on Pascal hardware, which adds VP9 and 10 bit support. The note about missing `ffnvcodec` from NVENC applies for NVDEC as well.
     156
     157Sample decode using NVDEC:
     158
     159{{{
     160ffmpeg -hwaccel nvdec input output
     161}}}
     162
     163Sample decode using CUVID:
     164
     165{{{
     166./ffmpeg-git -hwaccel cuvid -c:v h264_cuvid -i input output
    156167}}}
    157168
    158169Full hardware transcode with CUVID and NVENC:
    159 {{{
    160 ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input -c:v h264_nvenc -preset slow output.mkv
    161 }}}
    162 
    163 Partial hardware transcode, with frames passed through system memory:
    164 {{{
    165 ffmpeg -c:v h264_cuvid -i input -c:v h264_nvenc -preset slow output.mkv
    166 }}}
     170
     171{{{
     172ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input -c:v h264_nvenc -preset slow output
     173}}}
     174
    167175
    168176If ffmpeg was compiled with support for libnpp, it can be used to insert a GPU based scaler into the chain:
    169177{{{
    170 ffmpeg -hwaccel_device 0 -hwaccel cuvid -c:v h264_cuvid -i input -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow output.mkv
    171 }}}
    172 The {{{-hwaccel_device}}} option can be used to specify the GPU to be used by the cuvid hwaccel in ffmpeg.
    173 
    174 The note about missing `ffnvcodec` from NVENC applies for CUVID/NVDEC as well.
     178ffmpeg -hwaccel_device 0 -hwaccel cuvid -i input -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow output.mkv
     179}}}
     180
     181The {{{-hwaccel_device}}} option can be used to specify the GPU to be used by the hwaccel in ffmpeg.
     182
    175183
    176184= libmfx =