add option to calculate number of frames in the stream