In December, Lee Daniels was despondent that his new Fox TV series “Star” premiered to less than 7 million viewers. For encouragement, he called a friend. She happened to be named Oprah Winfrey. “I don’t understand this!” Daniels told her. But Winfrey wouldn’t let him wallow. “You petulant child!” she replied. “You have a good show. Your numbers are solid. Welcome to the real world.”

Daniels told this story at a keynote speech at SXSW on Sunday morning. He took a brief pause. “I still want those numbers, though,” he said with a laugh. At once serious, funny, rambling, and raw, Daniels — the director of such hit films as “Precious” and “The Butler” and the executive producer of TV’s “Empire” — delivered his talk with no pre-written remarks. Instead, he improvised tales about his poor upbringing in Philadelphia, knowing that he was gay at 8 or 9, lapsing into drugs, and starting a nursing business that gave him financial security.

By the time he finally got to Hollywood, he’d lived a long life, even though he was only in his mid 20s. His first job was as a production assistant for “Purple Rain.” Wealthy from selling his company, he arrived at the Warner Bros. lot in a Ferrari, dressed in a designer suit, smoking a Newport cigarette. Warner Bros. executives fired him, but Prince kept bringing him back.

“We were around the same age,” Daniels said. “He understood the vision. You know somebody who has experienced the streets.”

He rose up to a position called “head of minority talent” at the studio. “I was sitting there at a desk job. It was pre-Spike Lee, post Blaxploitation. There were no jobs for us.” He decided to bail to become a manager.

“It was so frustrating for me to see people like me unemployed,” Daniels said. “I got embarrassed telling these incredible actors there wasn’t work for them. I was making money, but the money was on the white cats.” One of his successful early clients was Michael Shannon.

As a producer, Daniels raised money — “some of it wasn’t legal” — to make “Monster’s Ball,” the 2001 drama that made history after Halle Berry became the first black woman to win the Oscar for best actress. “It was a big deal for me,” Daniels said. “You would have thunk Lionsgate would have built a fortress around me. I was getting offered movies like ‘Who’s My Baby’s Mamma’ and ‘Leprechaun From the Hood Part 7.’ I wanted to show a deeper side of me.”

He said he had to find his own way. “I’ve never had to depend on Hollywood,” he said, as he admitted not relating to the recent outrage for the lack of diversity at the Academy Awards. “I don’t understand the #OscarsSoWhite. I’m really trying to understand it. I paved my own way. I’ve believed we created a generation, at least with my kids, where you feel entitled. I had to fight for everything. No one owes me anything.”

Daniels spoke about struggling with the new wave of racism in America. “We’re in such difficult times right now,” he said, without mentioning Donald Trump by name at first. “This man is a reflection of who we are. He is a mirror of who we are. We let this man get into office. We are responsible for it. He is our karma. I’m trying to explain that to my son. It’s hard being a black dad. It’s frightening.”

He said that Hollywood could experience a creative renaissance, as artists rise up. “I couldn’t sleep,” he said, about the election. “I wrote some of the best stuff I’ve ever written in my life because of that, because I was so pained.” He compared the process to a snake shedding his outer skin. “It showed in the writing.”

Daniels said his favorite movie that he’s made is “The Paperboy.” He talked about how Nicole Kidman helped the other actors apply makeup, because he likes a collaborative spirit on his movie sets. For “The Butler,” he enlisted Winfrey to work on the costumes. “We’re all together,” he said. “What I found most charming about Oprah, she understands there was no ego.” He said turned to TV because of the economic realities of the business. “The only reason I did ‘Empire’ was so I could make some money for once.”

On 2009’s “Precious,” his breakout directorial feature, he recalled a memory that still haunted him. It involved a scene in the movie where his star, Gabourey Sidibe, dreamt of herself as a white woman. “I remember we had to find that pretty girl,” Daniels said. “She was there for only two days. I remember the entire crew treating this Nordic beauty like she was the star. And I remember from my peripheral vision, looking at Gabe, who had been giving her all, she was being ignored. It was on the only time I sobbed during the filming.”

As he told this story, he’d just noticed that Sidibde was in the audience, listening to his speech. He brought her onstage. “Why are you crying?” he asked her.

“You were very protective of me,” Sidibe said, wiping the tears from her cheek. “I was very little.”