Modified transcoder encode function to accept encoder via template argument (this makes it compatible with vakit encoder).