The "Blackbird" guitar accompaniment was an adaptation of a classical melody, says Sir Paul McCartney, In this clip, he shares that the 1968 Beatles' tune pulls from Bach's "Bourrée in E Minor," a well-known lute piece.
In a 2008 interview with MOJO, he said this:
We had the first four bars (of the Bourrée in E minor) and that was as far as my imagination went. I think George had it down for a few more bars and then he crapped out. So I made up the next few bars, and (sings his four-note variation Bach's theme) it became the basis of "Blackbird."
If the original sounds familiar, it's probably because you know it from Jethro Tull. They used it for the first eight bars of the piece as the basis of their 1969 song "Bourée."
This clip is from a 2005 appearance on Sir Michael Parkinson's TV talk show Parkinson. Incidentally, Parkinson was one of the people on the Paul McCartney and Wings' "Band on the Run" album cover. McCartney had told Parkinson that if he appeared on the cover, he would be a guest on his show. He eventually made good on that promise. The album came out in 1973 but his first appearance on the show wasn't until 1999. (reddit)