FFmpeg is an open-source collection of tools for processing video and audio files. It allows to convert video and audio files from one format into another, resize videos, stream audio and video, and perform various other actions with media files.
FFmpeg is quite easy to interact with Python via bindings but it's also a CLI which what I used to fixed bad video.
The simplest command we can do:
ffmpeg -err_detect ignore_err -i video.mkv -c copy video_fixed.mkv
ffmpeg -vcodec mpeg4 -b:v 7561k -qscale:v 2 -acodec aac -ac 2 -async 1 -strict experimental ./video_fixed.mp4 -threads 0 -i damage_file.mp4