If you want to overlay a rendered graphics on top of an image or a static video in Blender you should use the fSpy tool. It matches the camera to specified frame of reference. Unfortunately it doesn’t support EXIF meta information. That means that it sometimes fails to properly orient an image. When it comes to an image orientation there are two factors: how image is encoded and the EXIF orientation value. A great explanation can be found here.