encode_lavc: copy metadata to output file

As per #684. I'm not sure if this is the best way to do this though, but it seems to work (I've only tried with audio files though).

A nice followup could be adding a "--metadata" option to make it possible for users to set custom metadata, but I don't need this so I left it out for now.