When a slowly varying wavetrain of small amplitude propagates in a general medium, changes of frequency and wavenumber are determined along definite paths known as rays. It is shown that, for a wide class of conservative systems in fluid dynamics changes in amplitude along the rays may be computed from conservation of wave action, which is defined as the wave energy divided by the intrinsic frequency. The intrinsic frequency is the frequency which would be measured by an observer moving with the local mean velocity of the medium. This result is the analogue for continuous systems of the adiabatic invariant for a classical simple harmonic oscillator. If the medium is time dependent or moving with a nonuniform mean velocity the intrinsic frequency is not normally constant, and wave energy is not conserved. Special cases include surface waves on a vertically uniform current in water of finite depth, internal gravity waves in a shear flow at large Richardson number, Alfven waves, sound waves, and inertial waves in a homogeneous rotating liquid in geostrophic mean motion.