media_streams

Example of the component espressif/esp_iris v0.2.0
# Bounded image and audio streams

This dual-CDC USB example publishes two synthetic streams without a display,
camera, microphone, BSP, or GSP:

- **IMAGE:** RGB565 by default, with RGB888, valid embedded JPEG, and valid
  embedded PNG build profiles.
- **AUDIO:** 16 kHz mono PCM S16LE, emitted as 100 ms chunks containing a
  500 Hz test tone, 3,200 bytes per chunk.

Both producers check `esp_iris_media_is_streaming()` before generating data.
They remain idle until the host starts the corresponding channel and return to
idle after stop or disconnect.

## Standalone setup

Create this example from the Component Registry, then run the commands below
from its directory:

```bash
idf.py create-project-from-example "espressif/esp_iris=0.2.0:media_streams"
cd media_streams
```

With a source checkout, change to `ESP-Iris/components/esp_iris/examples/media_streams`
from the repository root instead. These application USB examples require an SDK
supporting ESP32-S31; the release matrix uses the pinned IDF 6.2 revision.
After the first build downloads the component, prepare its bundled Gateway:

```bash
python esp_iris.py setup
python esp_iris.py doctor
python esp_iris.py web
```

The launcher uses an isolated cached environment and does not change the IDF
Python environment. Close the Gateway before flashing or monitoring its ports.

## Build and flash

```bash
idf.py \
  -B build-media-streams build

idf.py \
  -B build-media-streams \
  -p /dev/serial/by-id/<programming-port> flash
```

Select another image format by adding an overlay defaults file while keeping
the base transport configuration:

```bash
idf.py \
  -B build-media-jpeg \
  -D 'SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.jpeg.defaults' build
```

The available overlays are `sdkconfig.rgb888.defaults`,
`sdkconfig.jpeg.defaults`, and `sdkconfig.png.defaults`. RGB565 is the default.
JPEG and PNG are static encoded fixtures; the raw formats animate. Opus is not
embedded because a product should submit packets from its own encoder.

CDC0 provides a text console for stock `idf.py monitor`; CDC1 carries image
and audio streams. Close Gateway before monitoring the same console. Flash
through the board's ROM download interface.

## Expected result

Start the image stream in the Workbench to see the selected format. Start audio
capture to receive the PCM tone. The audio media descriptor uses:

```text
width=16000   sample rate
height=1      channel count
stride=2      bytes per sample frame
format=ESP_IRIS_AUDIO_FORMAT_PCM_S16LE
```

Stopping either channel must stop its producer without creating a device-side
backlog.

Return to the [example index](../README.md).

To create a project from this example, run:

idf.py create-project-from-example "espressif/esp_iris=0.2.0:media_streams"

or download archive (~7.81 KB)