Just weeks before his death, Philip Seymour Hoffman was as off-kilter as some of his characters, witnesses say.

The 46-year-old actor — who was found dead Sunday in his West Village apartment — was “disheveled and pasty” at the Sundance Film Festival on Jan. 17.

At a party for the premiere of his latest film, “God’s Pocket,” co-star Christina Hendricks and director John Slattery chatted up reporters, but Hoffman initially holed up on another floor in the venue.

“He needed a minute and didn’t feel like coming down yet,” a rep said.

Eventually, Hoffman appeared wearing a red-and-white flannel shirt, dark checkered pants and snow boots and was in better spirits than he had been when he arrived.

Hoffman then told The Post he had long wanted to work with “Mad Men” actor Slattery, who made his directorial debut with “God’s Pocket” and lives near him.

“I’ve known John a while,” the actor said. “I could tell it was a very personal project for him.”

In the film, Hoffman plays a man who hides the truth about a freak accident that kills his stepson. At the premiere, he said he was drawn to the “middle-aged” character.

The actor was last spotted in public just over a week ago in the audience at Broadway’s “Waiting for Godot.”

He was in the midst of filming “The Hunger Games: Mockingjay — Part 2” and inpost-production for Showtime’s comedy “Happyish.”

Sources say he had a only week of shooting left for “Mockingjay” and his death wouldn’t affect its expected November 2015 release date.

“Words cannot convey the devastating loss we are all feeling right now,” the film’s director, Francis Lawrence, said in a statement signed by Jennifer Lawrence and other co-stars. “Philip was a wonderful person and an exceptional talent, and our hearts are breaking.’’

Hoffman had been slated to direct “Ezekiel Moss,” starring Jake Gyllenhaal and Amy Adams. It follows a drifter who communicates with the dead.