It is called "keying" where the object (or the background) is mostly of one color and can thus be separated based on color values. In After Effects there are several keying effects, the most powerful of which is Keylight. You select the color you want to isolate. Usually the selected color is the one that becomes transparent, but you want the reverse of that.
There is an additional step in isolating the fire from that footage which is that the origin point moves. You would have to track the end of the cannon and stabilize the shot around that point so that the fire doesn't move around.
So look up Keylight and keying as well as tracking and stabilizing and you'll soon know how to go about it.