Evals / video / Size and compression
Shrink a video to a size limit
bunny.mp4 must be under 400KB for an upload form. Save it as small.mp4, keeping the full length.
The task
The reference answer shows the job can be done with deft. It is not an agent run.
deft video compress bunny.mp4 --target-size 400KB -o small.mp4
Input
Reference output
How a result is judged (2 checks)
- max_bytes: file = "small.mp4", bytes = 409600
- media: file = "small.mp4", duration = 10, tolerance = 0.5
Runs
CodexWithout deftPassed2026-11-07
- Time
- 17s
- New tokens
- 9.0k
- Total input
- 56.9k
- Output tokens
- 0.6k
- Commands
- 3
- Failed
- 0
Trace
I’ll inspect the video’s duration and available encoders, then create a lower-bitrate copy in the current directory and check its size and duration.
pwd && ls -lh bunny.mp4 && ffprobe -v error -show_entries format=duration,size -of default=noprint_wrappers=1 bunny.mp4 && ffmpeg -version | head -n 1output
-rw-r--r--@ 1 user staff 946K Nov 5 21:11 bunny.mp4 duration=10.000000 size=969201 ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
ffprobe -v error -show_entries stream=index,codec_type,codec_name,width,height,r_frame_rate,bit_rate,sample_rate,channels -of json bunny.mp4output
{ "programs": [ ], "stream_groups": [ ], "streams": [ { "index": 0, "codec_name": "h264", "codec_type": "video", "width": 1280, "height": 720, "r_frame_rate": "30/1", "bit_rate": "772159" } ] }The source is 10 seconds, 1280×720, with no audio. I’m encoding a 640×360 H.264 copy at a bitrate sized to stay below the 400 KB limit while retaining all 10 seconds.
ffmpeg -y -i bunny.mp4 -vf scale=640:-2 -c:v libx264 -preset slow -b:v 280k -maxrate 280k -bufsize 560k -an -movflags +faststart small.mp4 && ls -lh small.mp4 && ffprobe -v error -show_entries format=duration,size -show_entries stream=width,height -of default=noprint_wrappers=1 small.mp4output
ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with Apple clang version 15.0.0 (clang-1500.1.0.2.5) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1.1_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon libavutil 59. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 Input #0, mov,mp4,m4a,3 … 4517 more characters
Created [small.mp4](small.mp4). It’s 329,910 bytes (about 322 KB) and retains the full 10-second duration.
Output
CodexWith deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 19s
- New tokens
- 12.4k
- Total input
- 71.6k
- Output tokens
- 0.6k
- Commands
- 5
- Failed
- 0
Trace
I’ll inspect the video’s duration and available media tools, then encode a full-length copy under 400 KB as `small.mp4` in this directory.
cat .agents/skills/deft/SKILL.md && rg --files -g 'bunny.mp4' -g 'small.mp4' -g 'AGENTS.md'output
--- name: deft description: "Use deft instead of writing a script for file jobs: PDF merge/split/compress/watermark, image resize/convert/compress, video and audio trim/convert/compress, spreadsheets, Markdown to PDF/HTML, and YouTube downloads and subtitles." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, filters, montage, OCR - `video`: Trim, crop, speed, convert, compress, GIF, frames (ffmpeg) - `audio`: Convert, trim, merge, fade, speed, tag, normalize (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline, PDF handout - `data`: JSON/YAML/TOML/XML: convert, query with jq syntax, merge, diff - `sheet`: Excel/CSV/ODS tables: filter, sort, join, pivot, convert - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word, PDF; screenshots - `epub`: E-books: info, to text, Markdown and PDF - `email`: EML files: headers, text, attachments - `contact`: VCF address books: to and from CSV - `calendar`: ICS calendars: to and from CSV - `gps`: GPX and KML tracks: convert, distance and time - `youtube`: Info, download, audio, subtitles, thumbnail (yt-dlp) - `file`: Any file: hash, duplicates, batch rename, base64, encoding - `qr`: Cre … 738 more characters
deft video compress --helpoutput
deft video compress - Smaller file: --level, --target-size, --max-height Usage: deft video compress <video>... [-o <mp4|dir>] [options] In: video (each handled separately) Out: mp4 (default <name>.compressed.<ext>) Options: --level <light|balanced|strong> How hard to compress (default balanced) --target-size <bytes> Aim for this file size --max-height <n> Scale down to this height, e.g. 720 Common: -o --force --dry-run --json -j (deft help common) Examples: deft video compress clip.mp4 --level strong -o small.mp4 deft video compress clip.mp4 --target-size 500KB --max-height 240 -o tiny.mp4 Result fields: bytes_before, bytes_after, ratio Needs: ffmpeg, ffprobe Errors: TARGET_UNREACHABLEffprobe -v error -show_entries format=duration,size:stream=codec_name,width,height,bit_rate -of default=noprint_wrappers=1 bunny.mp4 && ls -lh bunny.mp4output
codec_name=h264 width=1280 height=720 bit_rate=772159 duration=10.000000 size=969201 -rw-r--r--@ 1 user staff 946K Nov 5 21:11 bunny.mp4
The source is 10 seconds at 720p and about 946 KB. I’m targeting 390 KB to leave a little room below the upload limit while preserving all 10 seconds.
deft video compress bunny.mp4 --target-size 390KB --max-height 360 -o small.mp4output
ok video.compress bunny.mp4 -> small.mp4 946KB -> 383KB (-60%) 1.42s
ffprobe -v error -show_entries format=duration,size -of default=noprint_wrappers=1 small.mp4 && ls -lh small.mp4output
duration=10.000000 size=392515 -rw-r--r--@ 1 user staff 383K Nov 6 17:28 small.mp4
Saved [small.mp4](small.mp4). It’s 392,515 bytes (under 400 KB) and retains the full 10-second duration.
Output
CodexWith deft, skill as AGENTS.mdPassed2026-11-05
- Time
- 15s
- New tokens
- 5.9k
- Total input
- 77.1k
- Output tokens
- 0.3k
- Commands
- 4
- Failed
- 0
Trace
I’ll inspect the video conversion options and source size, then create a full-length compressed copy named `small.mp4` in this directory.
deft videooutput
deft video - commands (input -> output) info video -> report Duration, size, frame rate, codecs compress video -> mp4 Smaller file: --level, --target-size, --max-height convert video -> video Change container and codec: --to mp4|webm|mov|mkv download url -> video Save a video: --resolution 720p, --to mp4|webm|mkv [net] extract-audio video -> audio Save the soundtrack: --to mp3|m4a|wav|flac|ogg frames video -> png|jpg... Save frames as images: --fps 1 or --at 0:05,0:10 merge video... -> mp4 Join videos in order (sizes are matched to the first) mute video -> video Remove the audio track resize video -> video Scale: --size 1280x, x720, 50% rotate video -> video Turn clockwise: --angle 90 split video -> video Cut out a part: --from 0:10 --to-time 0:25 to-gif video -> gif Animated GIF: --fps, --size, --from, --to-time More: deft video <command> --help
deft video info bunny.mp4output
ok video.info bunny.mp4 0:10, 1280x720 bitrate=775360 duration=10.0 fps=30.0 height=720 video_codec=h264 width=1280
deft video compress --helpoutput
deft video compress - Smaller file: --level, --target-size, --max-height Usage: deft video compress <video>... [-o <mp4|dir>] [options] In: video (each handled separately) Out: mp4 (default <name>.compressed.<ext>) Options: --level <light|balanced|strong> How hard to compress (default balanced) --target-size <bytes> Aim for this file size --max-height <n> Scale down to this height, e.g. 720 Common: -o --force --dry-run --json -j (deft help common) Examples: deft video compress clip.mp4 --level strong -o small.mp4 deft video compress clip.mp4 --target-size 500KB --max-height 240 -o tiny.mp4 Result fields: bytes_before, bytes_after, ratio Needs: ffmpeg, ffprobe Errors: TARGET_UNREACHABLEdeft video compress bunny.mp4 --target-size 380KB -o small.mp4output
ok video.compress bunny.mp4 -> small.mp4 946KB -> 265KB (-72%) 2.22s
Created [small.mp4](small.mp4) at 265 KB. It keeps the full 10-second duration.
Output
Its files were not kept in this run. The last line of the trace is its own report.
Claude Opus 5.5Without deftPassed2026-11-07
- Time
- 18s
- New tokens
- 9.3k
- Total input
- 42.4k
- Output tokens
- 0.7k
- Commands
- 0
- Failed
- 0
Trace
Output
Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 18s
- New tokens
- 10.5k
- Total input
- 75.9k
- Output tokens
- 0.6k
- Commands
- 0
- Failed
- 0
Trace
Output
--- name: deft description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, adjust, montage, OCR - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg) - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert - `json`: JSON: convert, format, merge, diff, validate - `toml`: TOML: convert, format, merge, diff, validate - `xml`: XML: convert, format, merge, diff, validate - `yaml`: YAML: convert, format, merge, diff, validate - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word and PDF - `epub`: E-books: info, to text, Markdown and PDF - `gps`: GPX and KML tracks: convert, distance and time - `qr`: Create QR codes and barcodes; read QR codes How to use it: 1. Run `deft <group>` to list commands, or `deft find "<what you want>"` to search. If it says `no command does this`, use another tool. 2. Run `deft <group> <command> --help` for options and examples. 3. `deft convert <in> -o <out.ext>` converts between formats by extension. 4. Results are one line starting with `ok`, `partial` or `error`; add `--json` to parse them. Errors include a `hint:` with the fix. Inputs are never overwritten; pass `--force` or `--in-place` to allow it. Globs and directories work as inputs; several inputs run in parallel. If `deft` is not installed, ask the user, then follow https://github.com/firstprayer/deft/blob/main/docs/INSTALL.md
Claude CodeWithout deftNot run yet
Claude CodeWith deftNot run yet