The frameCount property of the ImageTrack interface returns the number of frames in the track.
frameCount
MDN Reference