The cause is that IrEncoder does not truncate the output file: when generating an IR file, if the destination file was already existing and the generated output takes less space than the current contents of the file, then the extra content at the end of the file is not removed from the output.
This makes the generated file unreadable.
A possible fix would be adding a channel.truncate(0) in the IrEncoder constructor.