The Beatles recorded this live on the Apple rooftop, which was used in their movie, Let It Be
. They played on the roof as a way to end the movie, which was footage of The Beatles working out songs in the studio.
Alan Parsons, who was an engineer on the sessions, told Songfacts
: "When the 'rooftop day' came and we recorded them on the roof, it made an enormous difference to the enthusiasm that they had for the songs."