mpeg12: Move finding the best frame rate to common code