begin encoder