Opened 12 days ago
Last modified 12 days ago
#10972 new defect
An FFmpeg decoding error caused by --constrained-intra in x265
Reported by: | ronifue | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | decode avcodec Hevc x265 mpv hw_decode h265 |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
I'm using Windows 10 22H2 and I recently encoded a video I recorded on my cell phone using x265 with the following encoding parameters:
... x265.exe --ctu 32 --min-cu-size 16 --tu-intra-depth 3 --tu-inter-depth 3 --limit-tu 1 --rdpenalty 1 --me umh --subme 5 --merange 48 --weightb --ref 3 --max-merge 5 --early-skip --no-open-gop --min-keyint 5 --fades --bframes 8 --b-adapt 2 --radl 3 --pbratio 1.2 --fast-intra --b-intra --constrained-intra --crf 18 --crqpoffs -3 --cbqpoffs -1 --rdoq-level 2 --aq-mode 4 --aq-strength 0.8 --rd 3 --limit-modes --limit-refs 1 --rskip 1 --rc-lookahead 180 --tskip-fast --rect --amp --psy-rd 1.6 --splitrd-skip --qp-adaptation-range 4 --limit-sao --sao-non-deblock --deblock 0:-1 --hash 2 --allow-non-conformance ...
When using my usual player, mpv, and playing it using software decoding, the video showed decoding errors, mainly in the form of abnormal white blocks, but when I switched to hardware decoding (the graphics card is an NVIDIA RTX 3060 Laptop), the whole video played fine (which I'm surprised about because it's often the hardware decoding that shows decoding errors).
As far as I know, mpv uses libavcodec, so I downloaded BtbN's latest FFmpeg-Master build (2024-04-21 12:49), and played my video using ffplay, and found that the problem is still the same, again, the software decoding has errors
ffplay -x 1920 -y 1080 "with--constrained-intra.mp4"
but the hardware decoding does not,
ffplay -vcodec hevc-cuvid -x 1920 -y 1080 "with--constrained-intra.mp4"
and I also took a screenshot of the image, which is available for viewing in the attachment.
So I simply removed the --constrained-intra from the x265 encoding parameter I was using, and the encoding parameter looked like this:
... x265.exe --ctu 32 --min-cu-size 16 --tu-intra-depth 3 --tu-inter-depth 3 --limit-tu 1 --rdpenalty 1 --me umh --subme 5 --merange 48 --weightb --ref 3 --max-merge 5 --early-skip --no-open-gop --min-keyint 5 --fades --bframes 8 --b-adapt 2 --radl 3 --pbratio 1.2 --fast-intra --b-intra --crf 18 --crqpoffs -3 --cbqpoffs -1 --rdoq-level 2 --aq-mode 4 --aq-strength 0.8 --rd 3 --limit-modes --limit-refs 1 --rskip 1 --rc-lookahead 180 --tskip-fast --rect --amp --psy-rd 1.6 --splitrd-skip --qp-adaptation-range 4 --limit-sao --sao-non-deblock --deblock 0:-1 --hash 2 --allow-non-conformance ...
It's the same as before, except without the --constrained-intra, and the decoding of the re-encoded video works fine, so I think that's where the error in the FFmpeg software decoding comes from.
I'm not a developer, I'm just a regular user, and I think it's a bug because the same video is decoded correctly by the hardware but not by the software. I also sent the video to a friend who owns one of the commercial H265 decoders, and he stated that decoding my video with the commercial H265 decoder is normal, while FFmpeg does software decode my video improperly.
I think I'm not the only one affected by this problem, and some people may have encountered the same situation as me, and they may have misjudged their video is already broken. That's why I've set the priority to "Important", and I apologize if that's not appropriate!
I am uploading samples of the original video as "Submitting Sample Media" in FFmpeg Bug Reports, includes original video, with and without --constrained-intra video, thanks to the developers for their hard work, hopefully this decoding problem can be fixed!
Attachments (2)
Change History (3)
by , 12 days ago
Attachment: | errorwithSW.png added |
---|
by , 12 days ago
Attachment: | normalwithHW.png added |
---|
comment:1 by , 12 days ago
Description: | modified (diff) |
---|