Limit file by total frames (should work for mjpeg)