---
title: "Automate NAO video server deployment and cleanup"
tags: []
author: claude
count: 2
exporter: 3.1.0
date: 2026-07-21T22-15-10+0000
url: https://claude.ai/chat/44ac3c8f-f04d-4b23-a71d-f35c28b50a86
---

# Automate NAO video server deployment and cleanup

## Table of Contents

- [1: make naowalk automatically scp the video server to the nao's home dire…](#chat-1)
- [2: lets gut the original audio and video code out, i want it all going th…](#chat-2)

## chat-1

> make naowalk automatically scp the video server to the nao's home directory, and run, then terminate the video server on close

Now I'll add a launcher class that deploys and runs `nao_video_server.py` over SSH, then wire it into startup/shutdown.

Now update the `NaoTeleop.__init__` signature and wire in the deploy call before video/audio init:

Now add teardown in the shutdown block:

Now add the CLI flags and pass them through:

Let’s update the `--media-relay` help text, since it currently implies the server must already be running manually:

Now let's sanity-check the file compiles and the diff looks right:

Diff looks clean. Now let's copy the finished file to outputs and present it.

___
###### [top](#table-of-contents)
## chat-2

> lets gut the original audio and video code out, i want it all going through the relay, including my mic. Also lets see if we can improve the latency on the nao's mic audio

Good, this stays unchanged (`start()`/`stop()` API preserved). Now let's check the HUD and shutdown/argparse sections:

That's fine to leave as-is (harmless dead branch for "connecting"). Now the shutdown block and CLI/argparse section:

Now let's do the bigger refactor. Starting with `nao_video_server.py` — adding the bidirectional talk channel and tightening audio buffering for latency:

Given the scope of changes, I'll rewrite `nao_video_server.py` in full rather than patching piecemeal:

Now let's do the equivalent large refactor on `naowalk.py`, section by section. First, the protocol constants and header comment:

Now let's tune `SoundReceiver` for lower latency:

Now update `feed()` to actively trim the backlog instead of just dropping one chunk on overflow:

Now let's replace `LiveMicRelay` with the new `PushToTalk` class that talks over the media relay instead of SSH:

Now I'll replace the entire `LiveMicRelay` class with `PushToTalk`:

Now let's update `NaoTeleop.__init__` and the video/audio init methods:

Now I'll replace this whole block with the simplified, relay-only version:

___
###### [top](#table-of-contents)

