Ooooh time for my horrible little theory about all that -- I have a thought that trying to burn Faramir alive, from Denethor's point of view, was love.
"Yeah, yeah, yeah, because he was crazy," some of you are saying, but no, you're wrong, it makes perfect sense actually. See, Faramir always had to come as Denethor's second priority, despite being his son. "Yeah, yeah, yeah, to Boromir," some of you are saying, but no, you're wrong. Not to Boromir. To Gondor.
Boromir was the favored son because Boromir's wants and desires rarely if ever conflicted with what Denethor had to do and be for the sake of Gondor. Boromir's motivations and interests were what Denethor believed Gondor needed. A strong military affinity. A modern mindset that would also always put Gondor first in the way that Denethor believed it needed to be put first. Faramir of course also put Gondor first, but he looked to the past for wisdom, and Denethor, not even unreasonably, if we're honest, didn't like that because the past had not protected Gondor. His comment about Faramir desiring to appear "gracious and merciful like the kings of old," combined with something Tolkien wrote about how if Gondor won the war and Denethor was in charge he would have demanded very unforgiving tributes from Harad and the east in retaliation for the role they played in the war despite the fact that they likely had little if any choice, combined with Faramir's willingness to consider issues from all angles and make exceptions to the rules when he believes it necessary paint a rather ugly picture about the specific points upon which Denethor and Faramir likely clashed -- Faramir was more than willing to fight in the service of Gondor, but not ruthlessly so. He embodies pity and mercy, the traits that Bilbo showed when he chose not to kill Gollum, and the traits that in many cases were the only reason the Ring got destroyed at all. But Denethor did not value those traits. He demanded ruthlessness, because ruthlessness was, he believed, the only thing that was going to save them. And so Faramir was the less favored child, not necessarily because Denethor didn't love him, but because he was something that Denethor didn't believe he could afford to love.
So when the enemy comes, and the city is surrounded, and Denethor sees in the Palantir the black ships (but not who is on them), and he sees in the Palantir the empty road northward (but not the secret roads through the Druadan that his allies were actually taking), and he sees in the Palantir the dead body of the messenger he sent to Rohan, still holding the arrow that he sent in a plea for help (but not the fact that Theoden received the message already and gave the arrow back), and when he sees in the Palantir Frodo captured, lying in a prison in Mordor without the Ring (but not Sam carrying it himself), Denethor assumes, quite reasonably, that all hope is lost. Minas Tirith can only last a few days against this assault. He has been led to believe that no help is coming. Despite everything he sacrificed for it, Gondor has fallen. There is no point in loving Gondor anymore. There's about to be nothing left to love.
So in those last moments, Denethor is finally able to love Faramir first, before Gondor. "Yeah, yeah, yeah, and then he lights him on fire," some of you are saying, and I mean, okay, you're right, but hey quick question, do you think being an important political prisoner of Sauron is fun? Do you think being the guy who led innumerable guerrilla assaults against Sauron's allies and weakened his forces and largely held Ithilien and Osgiliath against him for quite frankly a ridiculous amount of time all things considered would be a nice thing to be, if you also happened to be Sauron's prisoner? Do you think the captain who commanded the loyalty and admiration of all of Gondor's army, inspiring them to stand up and fight in the face of overwhelming odds would be having a good time in the dungeons of Barad-dur? And what is the point in asking Faramir to endure that? Gondor has fallen. Gondor is gone. Boromir believed, and Denethor almost certainly also believed, that Gondor was the one thing holding Sauron back from taking over the whole rest of the world that he hadn't already conquered. And he thinks Sauron has the Ring. The whole rest of the world is, from his point of view, just as doomed as Gondor. As far as Denethor knows, this is the end of the world. There's nothing after this, only eternal darkness and suffering. Why should he ask his son to endure that?
I'm not justifying any of Denethor's actions. I'm not even saying he was a good person. But rest assured that if it was Boromir and not Faramir lying injured and dying but still alive, Denethor would have done the exact same thing. He loved Faramir. He knew he loved Faramir. And he was showing Faramir love in the only way he knew of. And yeah it's awful, but you have to remember he was in regular direct contact with Sauron for 30 years. WHICH by the by, Sauron had Numenor doing human sacrifices to Morgoth in less than one year. The best he could get out of Denethor after thirty years was killing his son while he was unconscious because he loved him too much to allow him to suffer. So. There's that.