I’ve seen a few “behind the scenes” clips in which you can hear a lot of background noise not pertinent with the shooting. Recently on many sites there’s a clip of a sex scene; you can hear the director talking, giving instructions, while (quite distorted) music is played. I’m involved in audio production and I’m wondering how you can cancel all that stuff. I can understand the (high quality) music is added in post production, but what about the acting? Are the actors going to do a complete dubbing?
I agree with @Catija: ADR is very common with action, drama, and musicals because it is far easier (and less expensive) to rerecord the dialog in a recording booth than it is to get dozens to hundreds of people, who are near the shot, to be absolutely silent or to remove the sound in post production.
The only genre which avoids ADR is comedies because the timing is very important and hard to reproduce in ADR.
In a sound booth it is far easier for an actor to nail the vocal cadences to sell an emotional state or reaction and can be done in fewer takes which cost less. On a sound stage, there are layer upon layer of distractions and acoustic compromises starting with all the people watching, and ending with the set being too warm or too cold.
Many shots where there is no specific dialogue will be shot "MOS" - without sound running.
MOS is a standard filmmaking jargon abbreviation, used in production reports to indicate an associated film segment has no synchronous audio track. It stands for "motor only sync" or "motor only shot".
Omitting sound recording from a particular shot can save time and relieve the film crew of certain requirements, such as remaining silent during a take, and thus MOS takes are common on film shoots, most obviously when the subjects of the take are not speaking or otherwise generating useful sound.
If it's a sex scene, mouths are not likely on camera (if any dialogue is even occurring), so they will often do the dialogue in post or "ADR".
Automated dialogue replacement (ADR) is the process of re-recording dialogue by the original actor after the filming process to improve audio quality or reflect dialogue changes (also known as "looping" or a "looping session"). ADR is also used to change original lines recorded on set to clarify context, improve diction or timing, or to replace an accented vocal performance. In the UK, it is also called "post-synchronisation" or "post-sync".
It's also possible that the specific shots being captured that you saw were close-ups, details, or other shots that are more about the framing of the shot and the action in it.
If they were recording sound, I'd bet the director wasn't talking at the same time as dialogue was being said. A sound designer will be able to remove the part of the scene where the director is talking (assuming there's not too much other stuff like music in the background) and replace that with "room tone", which is generally 1 minute of "silence" recorded by the sound recorder so that the sound designer can use it as a base noise for the space.
In filmmaking and television production presence (or room tone) is the "silence" recorded at a location or space when no dialogue is spoken. This term is often confused with ambiance.
Every location has a distinct presence created by the position of the microphone in relation to the space boundaries. A microphone placed in two different locations of the same room will produce two different presences. This is because of the unique spatial relationship between the microphone and boundaries such as walls, ceiling, floor and other objects in the room.
Presence is recorded during the production stage of filmmaking. It is used to help create the film sound track, where presence may be intercut with dialogue to smooth out any sound edit points. The sound track "going dead" would be perceived by the audience not as silence, but as a failure of the sound system.
For interior sets some effort will be made to exclude extraneous background noise and sound recording equipment will be set of to focus on dialogue, for example by using boom mics just out of shot.
Even then most of the incidental sounds on the actual movie soundtrack will be added in post production by foley artists or samples. Indeed a huge amount of ingenuity goes into producing authentic sound effects. In modern production this may also include a huge amount of digital processing to layer and modify effects.
On exterior location this may not be possible and in some cases whole scenes may be redubbed with ADR which may even involve changing lines. For obvious reasons this is easier with long shot than close ups.
It is also possible to remove or mask any unwanted background noise with sound effects, score or digital/analogue filtering.