When writer-director Jeremy Saulnier and actor Anton Yelchin came together for “Green Room,” they bonded over a combination of punk rock spirit and an old-fashioned work ethic.

During a recent visit to The City, Saulnier (“Blue Ruin”) and Yelchin (the upcoming “Star Trek Beyond”) described their intense and rewarding work on the horror-thriller.

Saulnier was inspired by movies and music. especially punk, he knew as a teenager growing up near Washington D.C.

“It’s important to show the attraction of the music and how positive it is, even with the wide variety of ideologies associated with it,” Saulnier says. “Briefly, before things go south, there’s this synergy. Through the music they find this commonality, and it’s beautiful.”

The movie tells the story of a punk band, The Ain’t Rights, who play a show at a white supremacist club, then become trapped after they witness a murder.

Yelchin, playing the band’s bassist, wanted to get the feel of the music just right. “Learning the songs was important,” he says, “but even more important was just spending time together in rooms with instruments. We had to learn each other and we had to jam and come up with something. There’s a love there that’s shared when you do that. In that moment we became a band.”

The process of filming in the green room, where much of the action takes place, was tricky.

Yelchin found fuel for his performance in the room. “It’s emotionally helpful to be in a place where you can’t leave. Sometimes I was thinking: they’re only in here for 16 hours, and we’re in here for 20-plus days.”

“You’re covering eight people and you’re on 30 takes, and it starts to make less and less sense,” says Saulnier, describing the complexity of the situation.

Focusing on the actors was the key: “These lines are supposed to feel like they’re blurted out, impulsive and intuitive. It’s not snappy dialogue. The film really came alive when we started to overlap, interrupt the actors and make it seem haphazard.”

Messing with viewers’ expectations, from a memorable opening shot in a corn field to a great exchange of dialogue at the end, “Green Room” has a punk rock vibe throughout, seeming like a movie that teens from a previous generation would have watched on a VHS cassette.

“That would be cool to have it on VHS,” says Yelchin. Saulnier adds, “We may have to do something like that!”