Harry Potter no more: Daniel Radcliffe has left JK Rowling's hero in the distant past with a startling and explicit performance as beat poet Allen Ginsberg in his latest film.

Kill Your Darlings, the former child star's first film to be shown at the Sundance Film Festival, premiered at the independent-cinema showcase and puts Radcliffe into daring territory.

His young Ginsberg is initiated into drink and drugs, has oral sex performed on him in a library, has sex with one man and gets naked for sex with another man.

In a session with the audience at Park City, Utah, after the premiere, Radcliffe, 23, was asked if he chose the role because it fit the "weird stuff" he likes.

He conceded his tastes can run outside the mainstream.

"Films like this don't get made unless everyone involved loves them," he said.

The film recounts a little-known story of murder involving Ginsberg's circle of friends, including fellow future beat heroes Jack Kerouac (Jack Huston) and William S Burroughs (Ben Foster).

Dane DeHaan co-stars as Ginsberg idol and intimate Lucien Carr and the cast also includes Michael C Hall, Elizabeth Olsen and Jennifer Jason Leigh.

Director John Krokidas said Radcliffe became his muse on the film and that it was clear within minutes of their first meeting that the part was his.

Krokidas said young Ginsberg starts as a dutiful son who spends his time taking care of others, but eventually spills over with repressed passion.

"By the end of the movie he is a poet and a rebel," Krokidas said. "I had a feeling Dan might be able to relate to this."

Radcliffe has already demonstrated that he's not afraid of nudity for his art, when he played the lead role in Peter Shaffer's play Equus on stage.