Would Roger Ebert give a thumbs-up to a movie about his own life? Steve James hoped so, but he was uncertain. So was Ebert. His widow, Chaz, recalls him saying: A film about a film critic? That didn’t sound like a very compelling cinematic experience to the late Ebert, who, over his 46-year career reviewing movies for the Sun-Times, was arguably the world’s most famous judge of a film’s strengths and weaknesses.

But in August 2012, when James, a director from Oak Park, explained why he wanted to create a screen version of Ebert’s 2011 book, Life Itself, he made a persuasive pitch. “Look, the memoir is beautifully written,” he told Ebert and Chaz. “It’s poetic. It’s personal. It’s a great template for what the film could be. I envision going back and forth between your life in the present and telling your life story.”

James ultimately won over the couple. It helped that Ebert admired James’s previous documentaries, especially 1994’s Hoop Dreams, which he called “one of the great moviegoing experiences of my lifetime.” James also directed 2011’s The Interrupters, about Chicago violence-intervention workers.

James planned to film Ebert attending movie screenings and doing everyday things, like hosting a dinner party. While years of fighting cancer of the thyroid and salivary glands had deprived Ebert of the ability to speak without a computer’s help, it hadn’t sidelined him from a busy life. “Roger said, ‘If we’re going to do it, we’re going to be all in’—meaning we were going to give them complete access,” Chaz recalls.

But just before James started filming in December 2012, Ebert was hospitalized with a fractured hip. “Like any good documentary filmmakers, we decided, ‘Well, we should film him in the hospital. Hopefully, he’ll get out, but we’ll have that part of his story,’ ” James says. “But it got more complicated. He only came home for part of two days, and we were able to film that. He got pneumonia and he went back into the hospital, and from there it was a pretty precipitous decline.”

Despite that, Ebert—always the student of cinema—threw himself into the project. At one point, he told James to take a shot of him in a mirror. “He was very aware of the whole process,” says one of the film’s producers, Zak Piper. “He was having fun.”

About three months after filming had begun, Ebert, 70, found it increasingly difficult to answer the questions James was asking via e-mail. Ebert’s final message to James simply said: “i can’t.” Soon after that, on April 4, 2013, he died.

Though Ebert’s death obviously changed James’s shooting plans, it didn’t alter his basic template for the film: crosscutting between Ebert’s past and present. But Life Itself now became a film that was also about death. Instead of scenes like that dinner party James had envisioned, he used video of Ebert’s final weeks of struggling against illness. The death, says James, “put a different meaning on the footage we had gotten with him. Because of what happened, the film also ends up being about, How do you die with courage and dignity?”

One scene shows Ebert at his most vulnerable, lying in a hospital bed as he undergoes a suction treatment to clear his airway. Chaz says she was reluctant to let James capture moments like that. “Oh my God, I was against it,” she recalls. Even James had qualms: “I do remember thinking, Whoa, that was pretty intense,” he says. But when he got home that day, an e-mail from Ebert was waiting in his inbox. “Great stuff!!!” it said.

The film—opening in theatres (and available on video on demand) July 4—goes beyond Ebert’s book in other ways too. For example, James delved deeper into Ebert’s hate-love relationship with his longtime television cohost, the late Gene Siskel. James, says former Sports Illustrated writer and Ebert’s old pal Bill Nack, “did a really good job of braiding together all of the disparate strands in Roger’s life and not glossing over anything—which Roger would have appreciated, I think, as a journalist.”

James can only guess how Ebert would have reacted if he’d lived long enough to see the completed film. “I think we would have welcomed his feedback,” he says, laughing at the thought of the critic critiquing a film about himself.