Addresses issue #730 (closed) and #507 (closed). When adding a stream via a template, look up the encoder via the template codec's id, consistent with Transcoding.c in the ffmpeg source: https://github.com/FFmpeg/FFmpeg/blob/66deab3a2609aa9462709c82be5d4efbb6af2a08/doc/examples/transcoding.c#L149