Form = had been VERB+ing
We were relieved when the speech finally finished. We had been sitting there for more than four hours.
When Max finally showed up, Mary had been waiting for more than two hours.
The past perfect progressive is used to emphasize the continuous nature of an activity or event over a period of time and up to a particular time in the past. This sense of the past perfect progressive is often expressed with a time expression of duration.
The room went silent when Mary entered because everybody had been talking about her.
Max looked tired because he had been sleeping.
The past perfect progressive without a time expression of duration is used to express that an activity has been in progress recent to a particular time in the past.