If we neglect acceleration of piston then P = C = pequilibrium
W = P ∆V
To get the volume change from the height we need the cylinder area. The force balance on the piston gives.
The air that *** inside has not changed state and therefore not energy. The work leaves as flow work Pv ∆m.