#10972: An FFmpeg decoding error caused by --constrained-intra in x265
-------------------------------------+-------------------------------------
Reporter: ronifue | Type: defect
Status: new | Priority: important
Component: avcodec | Version: git-
Keywords: decode | master
avcodec Hevc x265 mpv hw_decode | Blocked By:
h265 |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
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!
Samples of the original video, with and without --constrained-intra I have
also uploaded as an attachment, thanks to the developers for their hard
work, hopefully this decoding problem can be fixed!
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10972>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac
To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".