The camera would probably only need to look at a very small section at high speed. They could be specifically made to film the tracks or the wheels of the train. Such cameras exist. Not cheap, but even some YouTubers have similar ones, to film high speed impact videos of things going much faster than trains. Might be worth it for trains.
https://de.wikipedia.org/wiki/RAILab
https://en.wikipedia.org/wiki/Doctor_Yellow
https://en.wikipedia.org/wiki/SNCF_TGV_Iris_320
https://en.wikipedia.org/wiki/China_railways_CIT_trains
https://en.wikipedia.org/wiki/New_Measurement_Train