The ferocious rhymes of hip-hop icons N.W.A.’s controversial 1988 anthem “F–k tha Police” scarcely seem to have aged when they blast on to the soundtrack of “Straight Outta Compton,” echoing into a world where the abuse of black Americans at the hands of law-enforcement officials remains common headline news. But if “Compton” is undeniably of the moment, it’s also timeless in its depiction of how artists and writers transform the world around them into angry, profane, vibrant and singular personal expression. A conventional music-world biopic in outline, but intensely human and personal in its characterizations and attention to detail, director F. Gary Gray’s movie is a feast for hip-hop connoisseurs and novices alike as it charts the West Coast rap superstars’ meteoric rise, fractious in-fighting and discovery that the music business can be as savage as the inner-city streets. A very smart piece of counter-programming in a summer dominated by lily-white tentpole movies, Universal’s Aug. 14 opener should keep the studio clocking much dollars at the late-summer box office.

When it dropped in 1988, N.W.A.’s first studio album (from which the movie takes its title) shook the hip-hop world from its solid East Coast moorings with its button-pushing, madly rhythmic depictions of thug life in South L.A. — an ur-text for the subgenre that would become known as “gangsta rap,” though N.W.A.’s members themselves preferred the term “reality rap.” Along with Public Enemy’s “It Takes a Nation of Millions to Hold Us Back” (released the same year), “Compton” was the album that fully announced hip-hop as the rage-filled protest music of its era — a primal scream from under the boot of white authority, or what the critic Nelson George called “the full-blown sound of revolution.” The group’s charismatic 19-year-old rapper and lyricist O’Shea “Ice Cube” Jackson (played here by his real-life son, O’Shea Jr.) said he and his bandmates were merely “street reporters,” filing dispatches from the from the front lines of a resource-starved community engaged in trench warfare with the Daryl Gates-era LAPD. Everything about N.W.A. was confrontational, starting with their name (short for “Niggaz With Attitude”).

Gray’s panoramic film (running a densely packed two-and-a-half-hours) is the story of N.W.A., yes, but also of the city in those same years — a long-simmering discontent that finally erupted into the 1992 riots. But first we begin in 1986 with the DNA of N.W.A. — the friendship between Cube and aspiring DJ Andre “Dr. Dre” Young (Corey Hawkins), and their courtship of a neighborhood drug dealer, Eric “Eazy-E” Wright (Jason Mitchell), to funnel some of his illicit funds into a record label (appropriately dubbed Ruthless) for burgeoning West Coast hip-hop acts. And it’s Wright (brilliantly played by Mitchell, the biggest revelation among the young actors) who emerges as “Compton’s” most compellingly complex character, a hip-hop Napoleon whose small stature and high-pitched voice mask a shrewd business acumen.

Even when Gray (who made his feature debut directing the real Ice Cube in the stoner-slacker classic “Friday”) puts “Compton” through the somewhat familiar biopic paces, he brings a richness of observation to the table that transcends cliche. (The exhaustively researched screenplay is credited to Jonathan Herman and Andrea Berloff, from a story by S. Leigh Savidge, Alan Wenkus and Berloff.) The live performance and recording scenes have the same loose, semi-improvised feel of the ones in the recent Beach Boys drama “Love & Mercy,” especially when Eazy steps up to a mic for the very first time to lay down his hit single “Boyz-n-the-Hood,” and Cube performs an early version of “Gangsta Gangsta” at a nightclub where slow-jam R&B is the house style.

These early brushes with fame bring the N.W.A. boys into the orbit of Jerry Heller (Paul Giamatti, sporting a swooping gray toupee), a veteran rock manager who pledges to lead his new clients into the lap of white music-biz respectability. But while Heller may be the prototypical wolf in Jewish cowboy couture, “Straight Outta Compton” is loath to pass rash judgments on its characters, whose motivations Gray and the writers strive to understand even when their actions verge on the monstrous. (The only unqualified monster here is the bodyguard-turned-mogul Marion “Suge” Knight, played with terrifying force of presence by R. Marcos Taylor.)

“Compton” doesn’t make the N.W.A. members themselves into paragons of virtue, even as it suggests that much of their swagger and braggadocio were more performance than reality — as well as necessary defense mechanisms on streets where real gangbangers posed a serious threat and where the police made little distinction between one type of young black man and another. Gray plunges us into that pressure-cooker atmosphere repeatedly, including one scene — depicted here as the inspiration for “F–k tha Police” — that can’t help but send a chill through the theater in light of the recent events in Ferguson and other black communities: While taking a break from the “Compton” recording sessions, the rappers are descended on by a swarm of Torrance cops who humiliatingly shake them down while disparaging the very existence of hip-hop.

Gray casts a wider net in the film’s second half, as friction among the three N.W.A. principals (over money, natch) sends them spinning off into their own orbits, Cube with movie projects and a platinum solo career, Dre as a prolific producer who — in and out of tumultuous partnership with Knight — helps to foster a new generation of hip-hop talent (including Snoop Dogg, Tupac and Eminem). The former friends turn rivals, trading barbed insults on their albums and occasional fisticuffs in public. Then L.A. burns, and out of the ashes, a relaxing of tensions — and hope of an N.W.A. reunion — begins to take hold. But even as the film broadens its scope, Gray’s direction remains sharp and vibrant, giving us a “Rashomon”-style sense of how post-N.W.A. life looked from each character’s perspective, and reaching unexpected depths of emotional power as Wright starts to succumb to the AIDS-related complications that would cut his life short, at age 31, in 1995.

The movie has been made in high but never overindulgent style, with Matthew Libatique’s richly textured widescreen camerawork deliberately avoiding shopworn images of South Central life while evoking a vivid sense of place, and the editing of Billy Fox and Michael Tronick keeping the complex narrative moving smoothly from beat to beat. The encyclopedic soundtrack — ranging across the N.W.A. catalog, its members solo ventures, their old-school R&B influences, and the top-40 pop hip-hop would displace as the dominant sound of the era — has been assembled with similarly meticulous care.