create encoded file first