These two soliloquies are actually quite similar in their motives and goals. In each, Hamlet is still trying to "spur" himself to revenge. He mentions the motivations that he has in both. In the Act II soliloquy he says that he "can say nothing; no, not for a king,/ Upon whose property and most dear life/ A damn'd defeat was made." Then in Act IV he still mentions his father, among all the other events that have come to pass:
How stand I then,
That have a father kill'd, a mother stain'd,
Excitements of my reason and my blood,
And let all sleep?
In both soliloquies, Hamlet has a legitimate reason to take revenge for what has happened. That being said, he also finds that he is embarrassed by the actions of the player and the Armies respectively.
In Act II, the player is able to bring himself to tears at the death of a character in his play. Hamlet's own father has been murdered and he can't bring himself to act. He laments:
A dull and muddy-mettled rascal, peak,
Like John-a-dreams, unpregnant of my cause,
And can say nothing;
In Act IV, he sees that twenty thousand men are brave enough to walk to certain death over a worthless plot of land, yet he has been unable to act until now. At the end of the soliloquy, he is inspired by their bravery and says: "O, from this time forth,/ My thoughts be bloody, or be nothing worth!" At the end of the play, we know that this time, he really means business!