Adjust -probesize and/or -analyzeduration.
The files I was testing were in fact damaged. But if anyone faces this problem, setting -probesize and -analyzeduration to 100 and 10000000 for example might help.
From a popular comment by @DiverseAndRemote.com
my solution was
ffmpeg -analyzeduration 2147483647 -probesize 2147483647 -i /path/to/video.mp4
2147483647 is max_int