Improeved 'codec' example (configurable encoder options)