Avoid reading one extra frame at the end of the input file.