The basic problem with “Straight Outta Compton,” F. Gary Gray’s docudrama about N.W.A., the group that made West Coast gangsta rap a phenomenon in the late eighties, is evident from the credits: three of the producers are Ice Cube (O’Shea Jackson), Dr. Dre (Andre Young), and Tomica Woods-Wright (the widow of Eric “Eazy-E” Wright and current CEO of Ruthless Records). That pretty much guarantees that the perspective is going to be skewered in favor of those three members of the group, and that they’ll be treated sympathetically, while other figures in the story will either get scant attention or be painted in negative terms. And that’s precisely what happens. So by no means should this be considered an objective piece of work: it’s an apologia, primarily for Cube and Dre, but to a lesser extent for Wright as well. And while shunting the others in N.W.A. off to the side, it paints certain people as villains.

So long as those limitations are understood, however, the picture, while overlong, proves an energetic, intense if utterly conventional portrait of an important moment in the evolution of American popular music. There’s nothing especially unusual about the narrative trajectory fashioned by scripters Jonathan Herman and Andrea Berloff—it follows the standard beats of musical biography in being a rise-and-fall story, with aspects that will be utterly predictable even if you’re not acquainted with the facts. (You’ll know, for example, that one character is doomed the moment he appears on screen. And a cough signals that death is not far away.)

The film starts off in 1986, when Wright (Jason Mitchell) was a small-time drug dealer and Jackson (O’Shea Jackson Jr., Ice Cube’s son) and Young (Corey Hawkins) were friends on the fringes of the East L.A. music scene, the latter a DJ in a local club and the former a natural wordsmith and aspiring rapper. Wright’s persuaded to sink some of his money into a demo disc on which he’s the initially reluctant front man on “Boyz-n-the-Hood”; it takes off and leads to the creation of Ruthless, attracting the attention of rock impresario Jerry Heller (Paul Giamatti), who persuades Wright to take him on as manager. He shepherds the laying down of the titular album that, along with N.W.A. itself, became a symbol of angry denunciation of establishment authoritarianism that resonated not only in L.A. but thro ugh the nation.

Gray and his cast catch the rush and the danger of that early success in concert sequences with screaming fans, confrontations with cops and frenzied free-for-alls in hotel suites. But Ice Cube begins to suspect that he’s being shafted in his share of the profits by Heller, who’s courted Wright to maintain control, and leaves to go solo, with—of course—amazing success, becoming the warrior who speaks unpleasant truths fearlessly and defies the powerful (including his old N.W.A. colleagues). Dre eventually leaves N.W.A. as well, joining forces with ex-bodyguard Marion “Suge” Knight (R. Marcus Taylor) to form Death Row Records. Cube and Dre get embroiled in verbal battles with Wright and Heller in their recordings, but eventually Dre, the sensitive, inspired songsmith, will break from the increasingly brutal, tyrannical Knight, whose threats against the two men and pillaging of the Ruthless artist roster shows his mercilessly predatory nature. As for Wright, he loses almost everything, including confidence in Heller, whose cooking of the books is finally revealed to him by none other than Woods (Carra Patterson). Just as Wright, the innocent patsy, is angling to get N.W.A. back together again, he falls ill, and the final reel of “Straight Outta Compton” becomes a eulogy to his very public passing, a victim of AIDS, in 1995.

Under Gray’s workmanlike direction, Hawkins and the younger Jackson do perfectly well as Dre and Cube, though the script frankly doesn’t invest either rapper with a great deal of complexity. The subsidiary members of the group—DJ Yella (Neil Brown, Jr.), MC Ren (Aldis Hodge, Jr.) and The DOC (Marlon Yates, Jr.) remain pretty much on the periphery of the action, but the most interesting character by far is Wright, the sparkplug of the group who’s ultimately taken advantage of by the untrustworthy Heller; Mitchell invests him with a good deal of emotional variety, and he plays well against the smarmy Giamatti, who, after this and “Love & Mercy,” seems to have cornered the market in sleazy manipulators of rock stars. He’s obviously one of the major villains of the movie (though, to be honest, the precise nature of Heller’s machinations are never really clarified), along with the even more unappetizing Knight, whom Taylor plays with bone-chilling ruthlessness. The other bad-guys are the cops, not only those in L.A., but those who show up in the picture’s recreation of N.W.A.’s notorious 1989 concert in Detroit, where the police actually stormed the stage. Every lawman in the picture comes across as a jack-booted crypto-fascist. Yet as the picture reminds us, with scenes of the 1992 South Central riots and glimpses of angry demonstrators trashing copies of N.W.A. records, it was a volatile era when problems that continue to plague the country today were just pushing their way into the national consciousness. The movie’s ultimate point is that N.W.A. was among the first cultural forces that compelled the U.S. to recognize the social problems of the inner cities, even if the means of addressing them have proven elusive over the past quarter-century and recent events have proved that they’re still very much with us.

And that’s why “Straight Outta Compton,” in spite of its debatable emphases and elisions, remains a powerful piece: it’s successful in setting the story of N.W.A. and its offshoots, for all its melodramatic flourishes, against the backdrop of significant societal turmoil, captured excitingly by Matthew Libatique’s robust camerawork, sharp editing by Billy Fox and Michael Tronick and the period-right production design (Shane Valentino), art direction (Christopher L. Brown), set design (Bryan Lane) and decoration (Christopher Carlson) and costumes (Kelli Jones). Obviously the audio is as important as the visuals here, and the music (supervised by Jojo Villanueva, with an original score by Joseph Trapanese) is skillfully presented by Willie Burton’s overall sound work and the sound editing by Mark P. Stoeckinger and Greg Hedgepath.

One can argue that this story might have been told with greater punch, more detail and less reliance on the tropes of the genre, but it’s still pretty solid and vivid as it is.