Now encodes correct number of frames (previously one too few).