Nevcairiel / LAVFilters

LAV Filters - Open-Source DirectShow Media Splitter and Decoders
GNU General Public License v2.0
7.18k stars 785 forks source link

Artefacts when hardware decoding HEVC file #534

Open dechamps opened 1 year ago

dechamps commented 1 year ago

This HEVC sample produces video artefacts when any hardware decoder is selected in the LAV Video options. Software decoding is fine.

If the hardware decoder cannot handle this bitstream then it would be nice if LAV could automatically fall back to software decoding instead of letting the hardware decoder choke on it.

Video
ID                        : 1
Format                    : HEVC
Format/Info               : High Efficiency Video Coding
Format profile            : Main 10
Format level              : 5.1
Format tier               : High
HDR format                : Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatible
Codec ID                  : V_MPEGH/ISO/HEVC
Duration                  : 14 s 97 ms
Bit rate                  : 38.4 Mb/s
Width                     : 3 840 pixels
Height                    : 1 920 pixels
Display aspect ratio      : 2.000
Frame rate mode           : Variable
Frame rate                : 5 498.475 FPS
Original frame rate       : 23.976 FPS
Color space               : YUV
Chroma subsampling        : 4:2:0 (Type 2)
Bit depth                 : 10 bits
Bits/(Pixel*Frame)        : 0.001
Stream size               : 14.5 GiB
Writing library           : x265 3.5+73-a7ca45961:[Windows][MSVC 1934][64 bit] 10bit
Encoding settings         : cpuid=1111039 / frame-threads=4 / numa-pools=24 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1920 / interlace=0 / total-frames=77512 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=5 / no-allow-non-conformance / repeat-headers / annexb / aud / no-eob / no-eos / hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=12 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=40 / lookahead-slices=4 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=4 / tu-intra-depth=4 / limit-tu=4 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=5 / limit-refs=0 / limit-modes / me=3 / subme=5 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / weightb / no-analyze-src-pics / deblock=-3:-3 / no-sao / no-sao-non-deblock / rd=4 / selective-sao=0 / no-early-skip / rskip / rskip-edge-threshold=0.020000 / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=17.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / min-vbv-fullness=50.0 / max-vbv-fullness=80.0 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=4 / aq-strength=1.00 / no-cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1) / cll=884,179 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-sbrc / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf
Language                  : English
Default                   : Yes
Forced                    : No
Color range               : Limited
Color primaries           : BT.2020
Transfer characteristics  : PQ
Matrix coefficients       : BT.2020 non-constant
Mastering display color p : BT.2020
Mastering display luminan : min: 0.0001 cd/m2, max: 1000 cd/m2
Maximum Content Light Lev : 884 cd/m2
Maximum Frame-Average Lig : 179 cd/m2
Nevcairiel commented 1 year ago

I don't see anything special in the properties of that video sample. It might be a hardware or driver bug, or a yet unknown limitation, or maybe even a glitch in the video itself that the software decoder manages to compensate for, for some reason.

ValeZAA commented 1 year ago

Does not happen in true HW decoder like LG C9. But happens in Davinci HW decoder. I imagine bug in Nvidia.

spheta commented 10 months ago

I'm also getting occasional artifacting when decoding HEVC with the LAV video decoder and DXVA2 native. They occur randomly and infrequent about once or twice an hour. The issue is still present in LAV as of 77.2.2. Im using a RTX 4090, could be a bug introduced at some point in Nvidia's drivers or a windows update as I don't remember this issue existing 6-8 months ago.