Past perfect continuous.

We use the Past perfect continuous to describe something that started in the past
And continued up until another moment in the past
(had been + present participle)
Example
He had been driving for 4 hours when the petrol ran out.
Had he been driving for 4 hours before the petrol ran out?
He had not been driving for 4 hours before the petrol ran out.
We can use the past perfect continuous to show cause and effect.
Example
Jim was hungry, he had been looking forward to dinner all day.
Lucy was tired, she had been working in the garden.
Robert missed the train because he had been reading his newspaper.
We can describe something had been happening for a period of time before
Another event.
It had been raining for 5 hours so the ground was wet.
They had been watching football for 2 hours when they heard the doorbell ring.
They had been playing tennis for 4 hours when Jon’s mother phoned.
Difference between past perfect continuous and past continuous.
He wasn’t working anymore.
He had been working for 6 hours before he took a
Break.
If you do not add a duration (such as 6 hours) it is possible to use the past
Continuous instead.
He was working and then took a break.
He had been working for 6 hours before he took a break

