count_frames is an API-only function which returns the number of frames defined for the PyMOL movie.
cmd.count_frames()
Frame, Count_States