# Capture video, planets or paired speckle

The complete source is included below.

```powershell
python -m nextastro_obs_client.examples.native_capture video --ra 12.5 --dec -30 --target "Video field" --filter V --frame-seconds 0.02 --duration 10 --roi-pixels 512
```

Prints the native capture metadata and file/report paths. Use mode planet for OBS's existing automatic exposure/candidate selection; --count counts retained still frames. Mode speckle requires --settings path/to/settings.json using the existing OBS speckle schema, including target magnitudes and reference information required by that routine; --count counts target/reference pairs. Native ROI is available for video and retains actual applied ROI in the result. Existing camera-specific capture limits/requirements still apply.

Student extension: Compare requested versus written video frames, inspect queue drops and link target/reference SRZ products.


## Python source

```python
"""Use OBS's existing native video, planetary, and paired-speckle capture paths."""
import json
from nextastro_obs_client.examples._common import parser, target_arguments, point, execute


def run(obs, camera, args):
    point(obs, args)
    if args.mode == "video":
        result = camera.video(frame_seconds=args.frame_seconds, duration=args.duration, count=args.count,
            filter=args.filter, target_name=args.target,
            roi={"mode": "max_pixels", "max_pixels": args.roi_pixels} if args.roi_pixels else None)
    elif args.mode == "planet":
        result = camera.planet(count=args.count, filter=args.filter, target_name=args.target)
    else:
        with open(args.settings, encoding="utf-8") as handle:
            settings = json.load(handle)
        result = camera.speckle(settings=settings, count=args.count, filter=args.filter, target_name=args.target)
    print(json.dumps(result.metadata, indent=2))
    print("Native capture paths:", result.paths)
    return result


def main(argv=None):
    p = parser("Native camera capture")
    target_arguments(p)
    p.add_argument("mode", choices=["video", "planet", "speckle"])
    p.add_argument("--count", type=int, default=1)
    p.add_argument("--frame-seconds", type=float, default=.02)
    p.add_argument("--duration", type=float, default=10)
    p.add_argument("--roi-pixels", type=int, default=None)
    p.add_argument("--settings", help="Speckle settings JSON using the existing OBS schema")
    args = p.parse_args(argv)
    if args.mode == "speckle" and args.settings is None:
        p.error("--settings is required for paired speckle capture")
    return execute(p, run, argv)


if __name__ == "__main__":
    main()
```

Shared argument and session helpers: [Example support code](support.md).
