On a blustery, bitterly cold day in London 50 years ago, John Lennon, Paul McCartney, George Harrison and Ringo Starr clambered to the roof of their record company, Apple Corp., for an impromptu lunchtime concert — stunning passers-by with the band’s first live performance in two and a half years.

It was also the last time The Beatles played in public.

Their 42-minute jam session, broken up by police over noise complaints, was filmed by director Michael Lindsay-Hogg as the capper to an intended TV special called “Get Back,” documenting the group recording an album.

“The original idea we had was to do a TV special, a version of [the Beatles TV movie] ‘Magical Mystery Tour,’ but not as conceptual,” Lindsay-Hogg, 78, tells The Post.

“We all wanted to shoot it in different places, but George wasn’t keen on it and wanted to keep recording.

“The idea for what became ‘Let It Be’ was that it was going to be a half-hour trailer before the TV special.”

Instead, it indeed did morph into the documentary “Let It Be,” released in May 1970, one month after The Beatles broke up. It included both the rooftop concert (cut to 21 minutes in the movie) and emotionally dark footage of the bandmates plus Lennon’s then-girlfriend, Yoko Ono, at turns bickering with — and ignoring — each other in the recording studio while creating their next album.

That album, “Let It Be,” was recorded before “Abbey Road” but was released in 1970 as the band’s final record.

The movie’s highlight was the concert, an iconic pop culture moment that came to signal the end of the world’s most famous rock ’n’ roll band and the turbulent decade they’d helped to define. The Beatles were loose and enthusiastic — despite the internal backstabbing and the cold weather — and ran through nine songs, starting with “Get Back” and including “Two of Us” and “Don’t Let Me Down.” They even polished off an old chestnut, “The One After 909” (highlight: a blistering guitar solo by Harrison), one of the first songs written by Lennon and McCartney in the late ’50s.

Lennon closed the concert after a reprise of “Get Back” with a dash of humor: “I’d like to say thank you on behalf of the group and ourselves — and I hope we’ve passed the audition.”

“What became ‘Let It Be’ was really an auxiliary documentary, which was all we had, then the famous rooftop concert, because there was no ending for it,” Lindsay-Hogg says. “There were fascinating shots of the Beatles playing, talking and interacting in the studio. Paul wanted to shoot the ending in the Cavern Club [in Liverpool] and I wanted to shoot it in an amphitheater on the coast of Tunisia.

“One day at lunch, about a week before, they didn’t want to do this or that so I said, ‘Why not do it on the roof?’ I was the only one who was thinking of the film. They’re all great musicians, but they were thinking of the second chorus in ‘The Long and Winding Road’ or whatever. I wanted to assemble a documentary with interesting footage but also with some high to end it on.

“There was no one else to have the idea [to film a rooftop concert] except me,” he says. “One day after lunch, which was served in the conference room at Apple cooked by nice girls in the kitchen — red and white wine, chicken, macrobiotics for John and Yoko — Paul, Ringo, myself and a few camera guys went up and looked at the roof. That was the embryonic idea on the Saturday before we filmed [the rooftop concert].

“As the week went on, The Beatles sort of pawed at the idea. If you gave them an idea, it was like throwing meat into a lion’s cage — they’d sniff and paw at it and throw it at each other, then that piece of meat came back in the end, but was different from what you put in the cage.

“We were going to film it the day before, but the weather was too cloudy and too murky. This was London in January,” Lindsay-Hogg recalls.

“Then we decided for the next day, Thursday. We wanted to hit 12 or 12:30 p.m. for the lunchtime crowds. We were standing in a little room at the bottom of the ladder which went up to the roof. George didn’t want to do it, he didn’t want to perform in public. He was more comfortable recording and getting it just right. And Ringo said, quite rightly, ‘It’s cold up there!’ Paul, who had been the most closely allied with me, said, ‘Let’s do it. It’ll be fun.’ The one voice we hadn’t heard from was John, who finally said, ‘Ah, let’s do it.’ ”

Lindsay-Hogg had set up a two-way mirror in the lobby of the Apple building to monitor any police presence.

“I knew there would be issues with the police,” he says.

“The firm next door [to Apple], which sold cloth or fabric, had complaints about the noise; the guys who managed it were traditional in the way people looked before rock ’n’ roll — one of the guys had a bowler hat and a big warm overcoat.

“We were all working and I was also trying to deal with not only what was going on up on the roof and in the street and the cops coming up, but all the funny things on the roof.

“There was a very proper Englishman wearing a coat and hat and smoking a pipe climbing up a pole to see them. For me, it was like, ‘I hope we pull this off,’ since it wasn’t a slam-dunk to get up there and do it. I was on the roof, not in a van with walkie-talkies and earphones, and I was trying to work out with the camera guys on the roof … how not to have the same shots. I had some signals … If I spread my hands at a wider angle, it meant go wider, if my hands were closer, it meant go closer. I also knew that was it.

“There weren’t going to be any retakes.”

Lindsay-Hogg says the original, longer movie was screened for The Beatles on July 20, 1969.

“When we showed the rough cut, it was the same day that Neil Armstrong landed on the moon,” he recalls. “There was more John and Yoko in the longer cut, then I got a call from [senior Beatles assistant] Peter Brown early the next day. He said he thought it was good but a bit long and said, ‘I think some of the John and Yoko stuff should come out. Let me put it this way — I’ve had three calls [from the others] this morning.’

“I think they thought that John and Yoko had more to do in the first act [of the movie] and it was taking away a little bit from The Beatles as an entity,” Lindsay-Hogg says. “So we cut some of that. United Artists wanted more of a musical picture than a documentary, so they came in late in the day and I had to angle it a bit more to music and less toward a documentary. Those were the kinds of changes we made. The Beatles were also the producers, not only the stars, and when things were going sour between them, they weren’t as interested.”

After its big-screen premiere, “Let It Be” largely disappeared from view. It was briefly released on home video in the early ’80s and, notwithstanding bootleg copies, hasn’t been widely seen since. Why? According to one theory, McCartney and Starr blocked its release, unhappy with how the band came across. Yet McCartney, who fought noticeably with Lennon and Harrison during “Let It Be,” told Rolling Stone in 2016 that he doesn’t object to it being released. “I keep bringing it up, and everyone goes, ‘Yeah, we should do that,’ ” he said. “The objection should be me. I don’t come off well [in the movie].”

Lindsay-Hogg says, “I think it was [pulled] partly because it showed aspects of them which maybe they were reluctant to see again. You had a sense in the movie that they were going to break up, which they eventually did. Even though they were still very close — John, Paul and George had been together since they were teenagers — by this time, they were men of 27, 28 and had other considerations.

“George was very sure he could go out on his own, which he did, and I think Paul wanted to keep the group together — he thought it was still his band. John and Yoko wanted to go off and do their own thing, [to be] much more bohemian. Ringo was partly this, partly that. It was a different time in their lives as a group and I think George, particularly, didn’t like revisiting that. I think he was the one less in favor of it coming out.

“After George died [in 2001], things sort of turned around a little bit. They’re all very strong personalities — certainly Paul, and Ringo in his own way, and Yoko representing John, and Olivia [Harrison] representing George. It’s kind of like turning an ocean liner around to get cohesion [between them]. You have to be respectful of that. They’re very sold in their opinions.

“But opinions also change, and what they think was negative 32 years ago might have become positive. It’s been a long time between the release of ‘Let It Be’ and now.”

Lindsay-Hogg hints that “Let It Be” will indeed be re-released in the near future. “You’d have to ask Apple about that, but I’m pretty sure something will be happening for a variety of reasons I can’t go into at the moment,” he says. “It’s kind of something we’ve all been talking about for quite a while and has gone through several iterations, but I think probably in the next 18 months, it will come out again in some form, or altered form, because people have weirdly been calling for it [to be re-released] for some time.”

Lindsay-Hogg is asked why there’s so much interest in the movie.

“Once they got on the roof, as cold as it was, they were that band that played together as teenagers in Hamburg,” he replies. “They loved playing, even if they couldn’t see the live audience. They would go over to look over the roof at the people below. They were very happy on the roof and doing the best they could.

“One of the things I like about ‘Let It Be’ is the happiness it shows between those four comrades.

“I didn’t know they were going to break up and this would be the last time, and really last time they would play live.

“I didn’t know when they walked off the roof that would be it: the end of the public Beatles.”