beginning encoding