Noisy video generated with a python script

I am trying to make a video with a script(2023_02_01_12_28_44/ParaViewScript.py in the folder linked below).
The video looks alright at the beginning, but from some point, it gets too noisy, as in the photo(full video is 2023_02_01_12_28_44/animations/2023_02_01_12_28_44.avi ).
This does not happen 100%, it’s sometimes okay, and can occcur at different timings.
How can I avoid this?

I put the paraview client information at the bottom. My OS is Ubuntu 22.04.1 LTS.

The script and the data are


Beginning


Later

Client Information:
Version: 5.11.0-RC1
VTK Version: 9.2.20220823
Qt Version: 5.15.2
vtkIdType size: 64bits
Embedded Python: On
Python Library Path: /opt/ParaView-5.11.0-RC1-MPI-Linux-Python3.9-x86_64/lib/python3.9
Python Library Version: 3.9.13 (main, Aug 28 2022, 04:26:48) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
Python Numpy Support: On
Python Numpy Path: /opt/ParaView-5.11.0-RC1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/numpy
Python Numpy Version: 1.21.1
Python Matplotlib Support: On
Python Matplotlib Path: /opt/ParaView-5.11.0-RC1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/matplotlib
Python Matplotlib Version: 3.2.1
Python Testing: Off
MPI Enabled: On
ParaView Build ID: superbuild 5d77dcfd71ab85235799c921f55ebb69e8b72630 (!1015)
Disable Registry: Off
Test Directory:
Data Directory:
SMP Backend: TBB
SMP Max Number of Threads: 24
OpenGL Vendor: NVIDIA Corporation
OpenGL Version: 3.2.0 NVIDIA 520.61.05
OpenGL Renderer: NVIDIA GeForce GTX 1080/PCIe/SSE2
Accelerated filters overrides available: No

Connection Information:
Remote Connection: No