We all know they’re out there, prying open garbage cans, scurrying across fences and maybe even bunking under your deck.

But urban raccoons are rarely studied, leaving humans in the dark about what the nocturnal animals get up to while we’re sleeping.

A new CBC documentary will change that. Raccoon Nation, airing Feb. 24 at 8 p.m. on The Nature of Things, was filmed largely in Toronto, the apparent “raccoon capital of the world” (a tagline unlikely to be used to promote the local tourism industry).

The film offers a glimpse into the secret lives of city raccoons, street-smart garbage-eaters who have more in common with people than you would think.

And it seems everything we’re doing to thwart those street-smart, garbage-loving raccoons is making them smarter.

“All the changes that we put in their way — be it bungee cords on our green bins and latches and all of these things — they figure out, because they’re so dexterous, and they have long memories,” says Susan Fleming, who directed and produced Raccoon Nation. “So now they’re amassing more knowledge.”

The documentary follows two researchers from York University who embark on a small study that produces fascinating portraits of the lives of five raccoons.

Psychology and biology professor Suzanne MacDonald and PhD student Marc Dupuis-Desormeaux tagged the raccoons with GPS collars to log their travels throughout the city, recording them at up to 1,500 points over six weeks.

They found that the raccoons live in small territories and avoid crossing major streets — which, given the risk of becoming road kill, is a key survival strategy.

Fleming and her crew pulled many all-nighters to gather footage for Raccoon Nation, watching the raccoons infrared cameras attached to long cables, which allowed the crew to hide in houses and cars while shooting.

“The more we filmed, the more fascinated I was by their behaviour, by their incredible memories and their hands, their family dynamics,” she says.

In one nail-biting scene filmed before dawn, a mother raccoon tries to teach her kits how to crawl down the roof of a shed and slip inside the partially open door. A few of the young have been trying to get in for more than two hours when the sun starts to rise, awakening some neighbourhood dogs, which begin to bark ominously. (Tune in to see if they make it.)

“The question we ask in the film is, are we encroaching on raccoon populations or are they encroaching on us?” Fleming says. “We’re moving into their territory, so we’re pushing them out, but they’re also coming into ours. They like it. It works for them.”