avformat: Free the internal codec context at the end