# Media Editor

> Server-side ffmpeg editing for audio and video.

Runs ffmpeg on our servers. Takes public HTTPS URLs as input and returns
`agent_file` objects with a `public_url` you can feed into the next step.

## What it can do

| Method | What it does |
| --- | --- |
| `mix_audio_to_video` | Mix one or more audio tracks (music, voiceover, sound effects) into a video file. Each audio track can have its own volume (0.0-2.0) and delay (seconds from video start). When keep_original_audio is True, use original… |
| `concatenate_videos` | Concatenate multiple videos in order into one file. Re-encodes to H.264/AAC for compatibility. All inputs: public HTTPS URLs (2-32 clips). |
| `resize_video` | Resize video: set width and/or height (pixels). Omit one dimension to keep aspect ratio (e.g. height=720, width=null → scale to 720p). |
| `remove_audio` | Remove all audio tracks from a video (video-only output). |
| `extract_audio` | Extract audio from a video to mp3, wav, or aac (returns agent_file). |
| `crop_video` | Crop video to width×height at top-left (x, y). All values in pixels. |
| `add_silence` | Add silence at the start or end of audio or video. For video, audio is re-encoded (AAC); video stream is copied where possible. |
| `replace_audio` | Replace the video's audio track entirely with another audio file (public URLs). Output mp4. |
| `normalize_audio` | Single-pass loudness normalization (dynaudnorm). Re-encodes audio; video stream copied if media_kind is video. |
| `merge_audio_files` | Concatenate multiple audio files sequentially into one mp3. Inputs normalized to stereo 44.1kHz before concat (2-16 URLs). |
| `create_video_from_images` | Build a video from ordered image URLs (slideshow). Each image shown for seconds_per_image; encodes H.264 (max 40 images). Images with different sizes are scaled to fit and letterboxed to a common 1280x720 frame. |
| `create_gif` | Convert video to animated GIF (palette, fps and max_width configurable). |
| `convert_format` | Remux/re-encode media to mp4, webm, mov, or mkv (from public URL). |
| `extract_frames` | Extract still frames from video at interval_seconds (max_frames cap). Returns multiple agent_file PNGs. |
| `extract_last_frame` | Extract a single still frame near the end of the video (ffmpeg -sseof + one frame). More efficient than extract_frames when you only need the last shot. Use seconds_before_end (e.g. 0.05) to sit closer to the final fr… |

## How to get credentials

None - Media Editor is a built-in tool. It runs on FlyMyAI infrastructure
using your account. Just enable it.

## Fields to fill in FlyMyAI

None.

## Troubleshooting

- **Input URL not fetched** - the URL must be a direct public HTTPS link.
  Pre-upload via `download_link` or another agent tool if the source
  requires auth.
- **Output too large** - use `resize_video` or `convert_format` to lower
  the resolution/codec before downstream steps.
