实际上,绝大多数的PC播放器都是基于ffmpeg开发的,这当中也包括各类解码器和渲染器!
而mpv的官方技术文档是我所见过的这些播放器中最详细,也是最专业的!原文如下:
Quality reduction with hardware decoding
In theory, hardware decoding does not reduce video quality (at least for the codecs h264 and HEVC). However, due to restrictions in video output APIs, as well as bugs in the actual hardware decoders, there can be some loss, or even blatantly incorrect results. This has largely ceased to be a problem with modern hardware, but there is a lot of hardware out there, so caveat emptor. Known problems are discussed below, but the list cannot be considered exhaustive, as even hwdecs that work well on certain hardware generations may be problematic on other ones.
In some cases, RGB conversion is forced, which means the RGB conversion is performed by the hardware decoding API, instead of the shaders used by --vo=gpu. This means certain colorspaces may not display correctly, and certain filtering (such as debanding) cannot be applied in an ideal way. This will also usually force the use of low quality chroma scalers instead of the one specified by --cscale. In other cases, hardware decoding can also reduce the bit depth of the decoded image, which can introduce banding or precision loss for 10-bit files.
vdpau always does RGB conversion in hardware, which does not support newer colorspaces like BT.2020 correctly. However, vdpau doesn't support 10 bit or HDR encodings, so these limitations are unlikely to be relevant.
dxva2 is not safe. It appears to always use BT.601 for forced RGB conversion, but actual behavior depends on the GPU drivers. Some drivers appear to convert to limited range RGB, which gives a faded appearance. In addition to driver-specific behavior, global system settings might affect this additionally. This can give incorrect results even with completely ordinary video sources.
mediacodec is not safe. It forces RGB conversion (not with -copy) and how well it handles non-standard colorspaces is not known. In the rare cases where 10-bit is supported the bit depth of the output will be reduced to 8.
cuda should usually be safe, but depending on how a file/stream has been mixed, it has been reported to corrupt the timestamps causing glitched, flashing frames. It can also sometimes cause massive framedrops for unknown reasons. Caution is advised, and nvdec should always be preferred.
crystalhd is not safe. It always converts to 4:2:2 YUV, which may be lossy, depending on how chroma sub-sampling is done during conversion. It also discards the top left pixel of each frame for some reason.
If you run into any weird decoding issues, frame glitches or discoloration, and you have --hwdec turned on, the first thing you should try is disabling it.
我节选一些重点来说:
理论上,硬件解码不会降低视频质量(至少对于编解码器h264和HEVC)。然而,由于视频输出API的限制,以及实际硬件解码器中的错误,可能会出现一些损失,甚至是明显不正确的结果,比如:
1、硬件解码可能会降低解码图像的比特深度,这可能会对10位文件引入条带或精度损失。
2、dxva2不安全。它似乎总是使用BT.601进行强制RGB转换,但实际行为取决于GPU驱动程序。一些驱动程序似乎会转换为有限范围的RGB,这会使外观褪色。
就我个人的实战体会:我是无法分辨出软解和D3D11硬解之间的画质差异,但是dxva2(copy back)还是能稍稍感觉到画面的质感是不如软解的!所以PC上用软解还是D3D11硬解,我个人是倾向于只要不影响视频的流畅播放,能软解就用软解,没必要让CPU太空闲啊!
而mpv的官方技术文档是我所见过的这些播放器中最详细,也是最专业的!原文如下:
Quality reduction with hardware decoding
In theory, hardware decoding does not reduce video quality (at least for the codecs h264 and HEVC). However, due to restrictions in video output APIs, as well as bugs in the actual hardware decoders, there can be some loss, or even blatantly incorrect results. This has largely ceased to be a problem with modern hardware, but there is a lot of hardware out there, so caveat emptor. Known problems are discussed below, but the list cannot be considered exhaustive, as even hwdecs that work well on certain hardware generations may be problematic on other ones.
In some cases, RGB conversion is forced, which means the RGB conversion is performed by the hardware decoding API, instead of the shaders used by --vo=gpu. This means certain colorspaces may not display correctly, and certain filtering (such as debanding) cannot be applied in an ideal way. This will also usually force the use of low quality chroma scalers instead of the one specified by --cscale. In other cases, hardware decoding can also reduce the bit depth of the decoded image, which can introduce banding or precision loss for 10-bit files.
vdpau always does RGB conversion in hardware, which does not support newer colorspaces like BT.2020 correctly. However, vdpau doesn't support 10 bit or HDR encodings, so these limitations are unlikely to be relevant.
dxva2 is not safe. It appears to always use BT.601 for forced RGB conversion, but actual behavior depends on the GPU drivers. Some drivers appear to convert to limited range RGB, which gives a faded appearance. In addition to driver-specific behavior, global system settings might affect this additionally. This can give incorrect results even with completely ordinary video sources.
mediacodec is not safe. It forces RGB conversion (not with -copy) and how well it handles non-standard colorspaces is not known. In the rare cases where 10-bit is supported the bit depth of the output will be reduced to 8.
cuda should usually be safe, but depending on how a file/stream has been mixed, it has been reported to corrupt the timestamps causing glitched, flashing frames. It can also sometimes cause massive framedrops for unknown reasons. Caution is advised, and nvdec should always be preferred.
crystalhd is not safe. It always converts to 4:2:2 YUV, which may be lossy, depending on how chroma sub-sampling is done during conversion. It also discards the top left pixel of each frame for some reason.
If you run into any weird decoding issues, frame glitches or discoloration, and you have --hwdec turned on, the first thing you should try is disabling it.
我节选一些重点来说:
理论上,硬件解码不会降低视频质量(至少对于编解码器h264和HEVC)。然而,由于视频输出API的限制,以及实际硬件解码器中的错误,可能会出现一些损失,甚至是明显不正确的结果,比如:
1、硬件解码可能会降低解码图像的比特深度,这可能会对10位文件引入条带或精度损失。
2、dxva2不安全。它似乎总是使用BT.601进行强制RGB转换,但实际行为取决于GPU驱动程序。一些驱动程序似乎会转换为有限范围的RGB,这会使外观褪色。
就我个人的实战体会:我是无法分辨出软解和D3D11硬解之间的画质差异,但是dxva2(copy back)还是能稍稍感觉到画面的质感是不如软解的!所以PC上用软解还是D3D11硬解,我个人是倾向于只要不影响视频的流畅播放,能软解就用软解,没必要让CPU太空闲啊!