# CoreMF media workflows

Process and transcode real footage on the CPU, or add optional GPU filtering
and composition. Both examples use the API-based `runAPI` runner and need no
tracking model or custom processing plugin. RTC/gateways and video frame/audio
sample plugins are separate evaluation paths with their own matching setup.

## Obtain the matching runtime

Request a CoreMF evaluation package for your target OS, modules and encoders under
agreed terms. This download contains workflow assets only: no CoreMF executable,
library, development headers, model or third-party encoder application.

- **CPU workflow:** software AV1 and AAC encoding, CPU decoding, resize and audio
  gain. No GPU is needed. Request the software AV1 encoder named in the supplied
  configuration and use an AV1/AAC-capable player for the output.
- **Optional GPU workflow:** GPU production filter, a supported GPU/driver and
  working hardware H.264/AAC output. The scene rejects software rendering.

Codec availability follows the delivered build. Follow the package's runtime
dependency instructions and make `runAPI` available on PATH.

## Files

| File | Purpose |
| --- | --- |
| `waterfall-input.mp4` | Fourteen seconds of 1280×720/25 fps footage with audio |
| `cpu/configs/default_videos.json` | Software AV1, 640×360, 25 fps; loaded when running inside `cpu/` |
| `waterfall-gpu.json` | GPU scene, animation and shader configuration |
| `waterfall-gpu.frag` | Original procedural shader; keep beside its JSON |
| `audio-gain.json` | Reduce recorded audio gain by 6 dB |
| `media-rights.json` | Footage origin, creator, license and source hashes |
| `NOTICE.txt` | Media attribution and software-rights boundary |
| `manifest.json` | SHA-256 hashes of the workflow files |

Extract the complete `coremf-media-workflows` folder. Use a new output filename
for each run. Start both examples from that folder; the CPU commands then enter
`cpu/` so the runner loads its encoder configuration.

## 1. CPU processing and transcoding

Decode, resize to 640×360, reduce audio gain and encode AV1/AAC to MP4. Hardware
decode and encode are explicitly disabled; this path has no GPU filter.

### Linux/macOS shell

```sh
cd cpu
runAPI -i ../waterfall-input.mp4 \
  -af gain -audio-filter-config @../audio-gain.json \
  -o cpu-workflow-output.mp4 -p tc -s 640x360 -r 25 \
  -gpl off --hw-codec off --hw-decoder off -j cpu-workflow.graph.json
```

### Windows PowerShell

```powershell
Set-Location cpu
runAPI.exe -i ../waterfall-input.mp4 `
  -af gain -audio-filter-config "@../audio-gain.json" `
  -o cpu-workflow-output.mp4 -p tc -s 640x360 -r 25 `
  -gpl off --hw-codec off --hw-decoder off -j cpu-workflow.graph.json
```

Inspect `cpu/cpu-workflow-output.mp4`, its exported graph and encoder diagnostics.
Confirm AV1 output, the requested dimensions and audio.

## 2. Optional GPU filtering and composition

Return to the archive's top folder first (`cd ..` if still in `cpu/`). Apply
color/effects, vignette, colorful bubbles, an animated detail view and titles.

### Linux/macOS shell

```sh
runAPI -i waterfall-input.mp4 -f glproduction \
  -filter-config @waterfall-gpu.json \
  -af gain -audio-filter-config @audio-gain.json \
  -o gpu-workflow-output.mp4 -p tc -s 1280x720 -r 25 \
  -gpl off --hw-codec auto -j gpu-workflow.graph.json
```

### Windows PowerShell

```powershell
runAPI.exe -i waterfall-input.mp4 -f glproduction `
  -filter-config "@waterfall-gpu.json" `
  -af gain -audio-filter-config "@audio-gain.json" `
  -o gpu-workflow-output.mp4 -p tc -s 1280x720 -r 25 `
  -gpl off --hw-codec auto -j gpu-workflow.graph.json
```

`-gpl off` restricts encoder selection; the runtime's own license and delivery
requirements are separate. An unavailable encoder or GPU must be reported as a
failure, not accepted as a software-rendering fallback or a successful evaluation.

## Inspect the result

- `cpu/cpu-workflow-output.mp4`: resized video and recorded audio at reduced gain;
  check the exported graph and software encoder diagnostics alongside it.
- `gpu-workflow-output.mp4`: color/effects, vignette, colorful bubbles, a moving
  detail lens and titles, with audible recorded audio at reduced gain.
- `gpu-workflow.graph.json`: the actual graph exported by the API runner.
- Runner diagnostics: selected encoder, GPU device/backend and any errors.

Play the entire output and check the beginning, final frames and audio. For an
engineering evaluation, also perform a complete error-checked media decode and
record timing, memory and application-specific acceptance criteria. GPU filtering
and hardware encoding are separate stages; the example does not establish an
end-to-end GPU-resident path.

Recorded October 30 Windows development checks fully decoded CPU AV1/AAC output
with 350 video frames at 640×360/25 fps, and GPU H.264/AAC output with 349 frames
at 1280×720/25 fps. The input has 350 frames; GPU frame equivalence is not claimed.
The GPU check used Intel UHD 770. These results do not qualify a commercial
package or other platforms. Linux/macOS commands need their own runtime checks.

## Integrate or extend

Use the SDK's application example and `CoreMF_API.h` to bring graph configuration
and lifecycle into your application. Custom video frame/audio sample processing
uses the matching native, Python or JavaScript plugin interface and its separately
agreed development materials. Tracking and other AI models remain optional,
separately supplied selections; these file workflows are not AI or plugin demos.

SDK/evaluation access, deployment, source and redistribution rights follow the
applicable agreement. Downloading these assets does not supply a CoreMF runtime
or grant production deployment rights.
