There is this thing that happens sometimes when you're shooting a movie where you have to replace the dialogue of an actor or actors in a scene (or several scenes) with something else. The process is called ADR (Automated Dialogue Replacement) or looping, and it's a pain in the ass.
A lot of times, if I'm lucky, I might be able to get a clean line delivery from a different take, or from a wild take. A wild take is something that is done during the shooting where if you know that your production sound may be compromised, you will do audio-only takes of the actors performing. It means that you can get the microphone in closer and not have to worry about it getting on camera. The true beauty of this is that the actor's energy is in the same relative place, and you're recording the sound in the same space so it will match if you have to drop in a line (or part of a line).
Sometimes, you just don't get that luxury. Either you might be working on a production where due to circumstances, someone else did the recording and didn't get wild takes, or there might be only one take, or the actors didn't deliver the lines consistently, or there was a technical fault, or there just wasn't any way to record meaningful sound. It happens.
Another thing is that when you do dialogue replacement in a scene, you really need to replace all of the dialogue in the scene from all the actors, or you end up with something that's really obtrusive (you've probably noticed it before, particularly with older movies). There are some rare exceptions to this, like if one actor in the scene has only one line, you might be able to get by with replacing just that one actor's line. The real difficulty is trying to match the sound of the room when you're recording it in a different location with different equipment. What it usually means is that you record the dubbed dialogue as dry as possible (meaning no reflected sound or noticeable echo or reverb), and add effects in the postproduction process. It's a real judgement call, trying to match how a room sounds to how a room looks like it sounds.
One of the things that I need to do for the ADR is to create and burn a DVD (or more than one as necessary) that has the scenes split into individual tracks, and put a small countdown leader on them. The basic idea is that I can then put the DVD into a DVD player and "loop" play that particular track so the actor can see and hear the timing and delivery of their lines and try and match them as closely as possible. It frees up the computer so that I can record the looped dialogue separately and direct to the hard drive.
Thing is that it takes some time to split the tracks. If I had the luxury of time, I'd actually go to the original captured footage and do looping on that, and that would allow for some more latitude in editing. At this point though, the edit is done, and it's gonna be faster to take it scene by scene from the edit.
Once that is done, I then need to weed out the tracks on a line-by line basis to find the one that is the best match for the performance, then do an alignment on it to get it to match the visual image as closely as possible. There are a couple of ways of doing this: the hardest way is to do it manually, which involves a whole lot of trimming and massaging and time compression and expansion. I've done this enough to know what a pain in the ass it is, but sometimes it's the only way that you can do it. If you're lucky, your actors deliver the lines with relative consistency, and it's not too difficult.
The second way involves using a program called VocAlign, which analyzes a guide track (preferably the production source audio) and does the massaging of the dub track (the one that's recorded in the ADR session) automatically. When it works, it's amazing. Getting it to work is kinda tough though. First of all, your guide track needs to be relatively cleanly recorded, which is rarely the case. Things like traffic noise, background noise, other voices, static, stuff like that can make it really difficult to lock on. Second, your dub track needs to be relatively close to begin with, or the corrections to it sound really weird, and it doesn't match the lip movements. It's possible to make some manual corrections, but it gets tedious.
What I've found is that sometimes I have to divide up individual lines into smaller pieces and assemble those together. I may have to get down to the level of a sentence or a phrase, or even in rare occasions a syllable or a sound.
Once the dialogue is replaced, I have to go back and build a new soundscape. It usually means that all of the little sounds (clothes rustling, footsteps, etc.) need to be added as well (the process is called Foley), as well as adding things like room tone (the basic background sound of a location) and effects, as well as music. There get to be a lot of layers to the sound, and it's a slow process. And assuming that I've done everything right, you'd never even know.
Which is really kinda cool.