[x264-devel] Corrupted slices

BugMaster BugMaster at narod.ru
Wed Oct 11 18:49:00 UTC 2023


On Wed, 11 Oct 2023 13:48:47 +0200, Jan Brothánek wrote:
> Hi,

> I ran into a bug occasionally causing output frames with gray stripes (see
> screenshot and output.mp4 in links below), using slices. Reproducible with
> these parameters (originally found using API) and input.mp4 (link below):

> x264 --bitrate 8000 --vbv-bufsize 1600 --vbv-maxrate 8000 --output-depth 10
> --profile high422 --output-csp i422 --preset ultrafast --tune zerolatency
> --threads 16 --slices 16 -I 120 -b 0 -o output.mp4 input.mp4

> Tested with 5a9dfdd (latest master), 5db6aa6 (from Ubuntu repo), aaa9aa8
> (from Centos7 repo), and 90a61ec. The bug seems to be non-deterministic but
> demonstrates similarly on similar frames - a complex scene followed by a
> simple scene that fades to white or black. It looks like the probability of
> corruption increases with the number of threads (that's why I used 16) and
> the VBV size limitation.

> screenshot of input frame:
> https://drive.google.com/file/d/1ZiVU5BrKYY_pWr-VzstnOl3AbcW96PhE/view?usp=drive_link
> screenshot of output frame:
> https://drive.google.com/file/d/1MhxC8GaKOfnCL11nPt2jsTVbX6kigVq_/view?usp=drive_link

> input.mp4:
> https://drive.google.com/file/d/1e8abTsbs8R-CxNNLDKy1jAfR66-guQMt/view?usp=drive_link
> output.mp4:
> https://drive.google.com/file/d/1YzcjVGkmzsHvGTXiOh1rVCXGTKw5kIVW/view?usp=drive_link

> Best,
> Jan

Hi.

Thanks for the test input file. I was able to reproduce the bug. This
is a bug in the VBV algorithm with multithreading, due to which it
enters emergency mode and increases QP to maximum values, deleting all
content in the slice. To hide (but not get rid of the bug), you can
set --qpmax 51 (or less) so that VBV does not go into emergency mode
(with an increased risk of VBV overflow). I'll think about how to
safely fix this problem.



More information about the x264-devel mailing list