Where does the phrase "dead as a doornail" come from?

The answer is straightforward enough: a dead nail is one whose point is bent over on the other side and hammered flat, making it all but impossible to remove from the front—and unrecoverable for future re-use, therefore dead. But Malcolm P.L.'s video explains it so beautifully.