McCartney, a widower with grown children and well-known vegetarian who wants to be both eco and animal friendly, tapped into his emotions for both projects.
McCartney has written only a handful of songs specifically for films. He said he decided to contribute the emotional ballad "(I Want to) Come Home" for the story about a widower learning about his grown children after the former Beatle saw an advance screening of the movie.
But there are only so many songwriting suggestions an outsider is allowed to offer Paul McCartney. Kirk Jones, director of the movie, "Everybody's Fine," found the limit.
When Jones had some editing suggestions, McCartney listened. He added an instrumental intro to the song and switched the first and third verses, things he'd actually been considering anyway. Then Jones suggested a change in the lyrics.
This was one of popular music's most storied songwriters, after all.
"I remember going over in the cab (to meet McCartney) and saying the only way I could do justice to him and the film was to be honest," Jones said. Both McCartney and DeNiro are surrounded by people who tell them what they want to hear; he believed they would appreciate someone who would be straight with them.
With McCartney, he settled for two out of three.
"I don't want to be above the process," McCartney said. "I don't want to be one of those people who says, `How dare you play with my music! My music is sacred!' I wrote for a movie. I might as well hear what the director has to say. But when he did go a comment too far, I did shut the door."
Jones had almost lost McCartney earlier. As McCartney sat in the screening room and the movie reached the emotional climax where he knew that any song he wrote would appear, he heard the placeholder that Jones had also considered: Aretha Franklin singing McCartney's Beatles classic "Let it Be."
No pressure there.
"I go, `I can't do this!"' McCartney said. "`Are you kidding me? I can't do that.' My immediate reaction was, `No way, dude."'
But after seeing the movie, an idea came to him the next night.
"I thought, `I like the film so much I'll see if it works,"' he recalled. "Gradually, from there, I tried to use (`Let it Be') as an inspiration for a new, different kind of song, but hopefully in the same emotional ballpark."
Jones said he loves how the new song works for the movie.
"I love the fact that it was written and sung by a man who has lived a life and experienced a number of things that were related to the movie," he said. "I think it was sung with heart and passion and with honesty as well."
The 67-year-old McCartney acknowledged that some tears flowed when he saw a screening, clearly identifing with DeNiro's character. He and his wife Linda, who died in 1998, have three children, and he adopted her daughter from a previous marriage. (He also has a 6-year-old daughter with his ex-wife Heather.)
"The fact that he's lost his wife and has grown-up children with situations of their own and is trying to get them all around the table - I could relate to that quite easily," he said.
The new song adds to a relatively limited canon of McCartney film work, except for his own movies. The Bond epic "Live and Let Die" is his best known, probably followed by the title cut for Cameron Crowe's "Vanilla Sky." McCartney wrote for the 1980s film "Spies Like Us" - even he acknowledges that contribution wasn't particularly memorable - and the 1960s flick "Family Way."
McCartney said he wrote "(I Want to) Come Home," as might be expected, from the perspective of DeNiro's character. But when some of the lyrics are read back to him, he realized it could also be heard from the adult children's view and maybe he was considering that subconsciously.
"That's the best stuff," he said. "The magic of songs and the magic of composing is you don't always know what you're doing, and that's what hooks me into it, and why I could never stop composing."
"Everybody's Fine" opens in theaters Friday.
When McCartney isn't brainstorming and making music that moves the masses, he is taking on other causes, like "Meat-Free Mondays."
In his presentation Thursday before the European Parliament, he said the power to halt global warming lies as much with individuals as with their governments.
McCartney met in Brussels with Rajendra K. Pachauri, head of the U.N.'s global climate change panel, and praised the virtue of skipping meat one day a week for the sake of the environment.
"I grew up as a kid not eating meat on Fridays," McCartney told reporters. "It was part of the rules of the school I went to.
At a time of concerns over global warming, McCartney added, there are "even more crucial reason" to skip meat.
The former Beatle said the production of food - from farm to fork - accounts for 20 to 30 percent of global green house gas emissions. Livestock production is responsible for around half of these emissions.
Still, he admitted that his flight from London to Brussels - and on to Berlin for a concert later Thursday - had contributed to global warming.
"They haven't invented microphones that work on candle power," he said. "I do everything I can. If I go for a car, I go for hybrid. I recycle."
Pachauri lauded McCartney's initiative, saying it "certainly makes the tasks of governments so much easier."
Earlier, Pachauri met with European Commission President Jose Manuel Barroso, who said even if the global climate conference opening in Copenhagen next week does not yield a final accord it must "light the pathway to a legal agreement" on reducing greenhouse gas emissions.
Barroso said he was heartened that "around 90" government leaders are coming to Copenhagen for the Dec. 7-18 U.N. climate meeting.