That will be most easily achieved with a compositing program like After Effects, Nuke, Fusion or similar. You'll need to rotoscope a mask around the foreground element. Hopefully that gives you an idea of what you need to do.