Please compare Hamlet's soliloquy at the end of act 4, scene 4 with act 2, scene 2.
The tone of Hamlet's soliloquy at the end of act 2, scene 2 is frantic. He is desperate to uncover the truth about Claudius: "If he but blench, / I know my course." He is distraught that a mere actor can bring tears to his eyes over the imagined actions of Hecuba, and Hamlet sees himself by comparison as dull and hesitant, seeming to be an actor in someone else's life.
Hamlet is pretty self-loathing in this speech, referring to himself as a villian, a slave, hesitant, a coward, an an ass. He feels simultaneously compelled to act on behalf of his father's murder and unsure if he has the courage to do what is needed to uncover the truth and then act on it. By the end of this soliloquy, he bolsters up his resolve for action: "I'll have grounds / More relative than this. The play's the thing / Wherein I'll catch the conscience of the king."
In act 4, scene 4, Hamlet has emerged as a more steady voice. Here, he feels confident that "all occasions do inform against [him] / And spur [his] dull revenge." He still believes himself to be somewhat cowardly, but not in the frenzied, self-depreciating way as he did before. Here, he notes that he possesses "cause, and will, and strength, and means / To do't." This type of inner strength isn't present in act 2. While he still considers himself to have one part wisdom and three parts cowardice, he steadily declares, "My thoughts be bloody, or be nothing worth!" Hamlet is transforming into a man who sees the destiny laid out before him that demands he avenge his father's death, and he is settling in to accept what must be done.
In act 4, scene 4, Hamlet is chiding himself over his failure to act and avenge the death of his father. He knows what must be done, yet somehow can't quite bring himself to do it. He is especially ashamed that twenty thousand men are prepared to fight and die over a tiny strip of land and yet he can't even summon up the courage to kill just one man, namely Claudius. Hamlet concludes the soliloquy by trying to psych himself up. From now on, he tells himself, all his thoughts must be bent towards violence, otherwise they'll be worthless:
Oh, from this time forth,
My thoughts be bloody, or be nothing worth!
Hamlet is similarly full of self-reproach in act 2, scene 2. Whereas in the other soliloquy he compares himself unfavorably with soldiers, he now does so with actors. If the lead player in The Murder of Gonzago had had the same feelings as Hamlet, he would've drowned the audience in tears of rage and grief. Unlike Hamlet, he would certainly have acted. Yet what does Hamlet do? Nothing. He just mopes around like a dreamer:
. . . Yet I,
A dull and muddy-mettled rascal, peak
Like John-a-dreams, unpregnant of my cause,
And can say nothing . . .
Though there is a difference with this particular soliloquy—Hamlet's actually put in place a plan of action. Staging The Murder of Gonzago and gauging Claudius's reaction, though somewhat convoluted as a plan of revenge, does at least show that Hamlet's actually doing something. Whereas in the soliloquy at the end of act 4, scene 4, Hamlet is just all talk. The subtle contrast between the two soliloquies shows once again that Hamlet's real talent lies in contemplation rather than action.
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!