How to use python to copy video settings from the compositor to the 3D viewport
OK!!! I finally worked it out.

In case anyone else needs this, here are examples:

Set-up Variables

clip = 'your.video.filename.mp4'

bg = bpy.data.screens['your.screen'].areas[n].spaces[0].background_images[0]

node_im = bpy.data.scenes['your.scene'].node_tree.nodes[clip]


Copy Video and Properties

bg.image = bpy.data.images[clip]
bg.image_user.frame_start = node_im.frame_start
back_im.image_user.frame_offset = node_im.frame_offset


Notes

Blender automatically assigns e.g. 'your.video.filename.mp4' as the image reference when you load a video into an image node. You can change that if you want, but beware that if you reload the clip, the field will revert to the clip's filename.

Finding 'n' from 'areas[n]' takes a bit of trial and error, especially if you have a complex screen.

for area in bpy.context.window.screen.areas: print(area.type)


outputs a list of the areas of your screen, so at least you can narrow down which are viewports.

After that:

bpy.data.screens["your.screen"].areas[n].spaces[0].background_images[0]


will tell you what,if any, image has been assigned to areas[n]'s background.

I have to say I'm surprised that this hasn't come up before - seems to me that duplicating a video background node in a 3D viewport would be a common need.