How to overlay 3d scene over 2d video feed

Ah, for that you need have to do some math with the camera frustum. You need to calculate how far away from the camera one unit will equal to one pixel.

So, if your video is 1024x768 for example, then your scene will have the same aspect ratio, and you need to position objects far enough away from the camera so that 1 unit left/right/up/down will be 1 pixel in the video.

This might be of use:

There are probably other ways to do it, but if you use that function linked there, the object you will fit into the screen should be 1024 units wide, then you’ll have the result for the distance.

Basically its just doing trigonometry with the camera frustum.

That’s one thing. Another thing is, if you want to match 3D objects in the scene with 3D objects in the video, then you need to match the video camera frustum to the scene frustum so that the proportions and perspective will be the same, etc.