The scenes featuring Dobby and Kreacher were filmed twice. First they were played physically on set by their respective voice actors, so the other actors and animators had a guideline to work with. Then the same scene was shot without the voice actors, so the SFX team could put in their CG characters in post-production.
Harry Potter and the Deathly Hallows: Part 1 (2010)