In the video I see that the author needs quite some force to load the gun. So here he puts the projectile in a high potential state, i.e. he provides the energy during the loading process. When released this energy accelerates the projectile. Hence, no violation of energy conservation.
Here a small representation with python and ten dipole magnets:
Top: field lines in top view. Bottom: x-Field (arb.u.) on projectile path.
If you came from the left you have to somewhat overcome the negative bump. You see that the last max is almost as high as the first min is deep. That's why lubricant is important, as metnioned by @xcoderx. Actually, the thing looks better if you make it shorter. On longer ones the max approaches a saturation value and you'll have more friction loss.
Just looked at the video again because the author inserts the magnet as [NS] and [SN]. The behavior corresponds to the lower graph. In one case one has to overcome the first bump by pushing, but the total distance is not very much as the magnet is later attracted by the second bump. In the second case, the reversed magnet is attracted by the first bump, the author then pushes it over the second bump, which the naturally results in a larger distance.