I'm a little confused about why the Lagrangian is Lorentz invariant and the Hamiltonian is not. I keep reading that the Lagrangian is "obviously" Lorentz invariant because it's a scalar, but isn't the Hamiltonian a scalar also? I've been thinking this issue must be somewhat more complex, because mass is an invariant between frames, and it's a scalar, but energy obviously isn't invariant, and it's a scalar too, so I guess I'm missing something. Is it related to the fact that energy is a component of the 4-momentum? Any help is appreciated!