Bug #3631

Bug #3631. The constant max_number_of_attempts is too high and causes an unnecessary delay (around 4 seconds) after the last frame read from the video. Fixed to a smaller value.