# raea media

> Probe, cut, measure and encode media natively, the same on the Mac and the iPhone, with no ffmpeg.

`raea media` does the media work agents used to reach for ffmpeg and ffprobe for, on raea's own decoders and
encoders: probing a file, pulling a still or a contact sheet, reading loudness and motion, finding cuts and freezes,
trimming, joining and encoding. It works the same on every platform raea runs on, and nothing calls an ffmpeg binary.

```sh
raea media probe take.mov                          # duration, size, fps, codec and audio, as JSON
raea media still take.mov --at 12.5 -o at-12.png
raea media sheet piece.mp4 -o sheet.png            # a contact sheet of the whole piece
raea media loudness piece.mp4                      # integrated LUFS and true peak
raea media cuts footage.mp4 --threshold 0.08       # where the shots change
raea media trim take.mov --from 12 --to 18.5 -o line.mp4
```

`raea ffmpeg ...` and `raea ffprobe ...` read the command lines models write by habit and run them as these verbs;
what they can't read is refused with the verb or edit that does it.


## Usage

```sh
`raea media VERB ...`: the agent's media work, native and the same on the Mac and the iPhone (docs/media.feature M1).
What agents used ffmpeg and ffprobe for, on raea-media (the platform's decoders and encoders, Symphonia's audio):

  raea media probe FILE                                   duration, size, fps, codec, audio (JSON)
  raea media still FILE --at S -o OUT.png|.jpg            the frame showing at S
  raea media sheet FILE... [--n 12] [--width 240] -o OUT  a contact sheet (n frames of one file, or each file's middle)
  raea media audio FILE [--rate 16000] [--mono] [--from S --to S] -o OUT.wav|-   (- is f32le on stdout)
  raea media loudness FILE [--from S --to S]              integrated LUFS, mean and peak dB, true peak
  raea media motion FILE [--from S --to S] [--fps 6]      how much the picture changes (mean luma difference, YDIF)
  raea media cuts FILE [--threshold 0.08]                 shot changes (ffmpeg's scene score)
  raea media freezes FILE [--noise 0.001] [--min 2]       held pictures (ffmpeg's freezedetect)
  raea media proxy FILE [--height 720] -o OUT.mp4         a smaller copy
  raea media trim FILE --from S --to S -o OUT.mp4         a stretch, frame-exact (re-encoded)
  raea media concat A B ... -o OUT.mp4                    one after another (same aspect)
  raea media encode --size WxH [--fps 60] [--quality Q] [--audio FILE] -o OUT.mp4   raw RGBA frames on stdin, signed

`raea ffmpeg ...` and `raea ffprobe ...` read the command lines models write by reflex and run them as these verbs; what
they can't read is refused with the verb or edit that does it. No ffmpeg binary is involved.
```

Headless: it needs nothing running and opens no window. Its arguments go to a parser of its own, whose forms are listed above.
