Koldflux test log: reduce-video-size-for-email-discord, 2026-11-26 Inputs (sha1, first 12): in/mahmudabad01..04.ogv 71.9, 52.9, 50.8, 49.4 MB f42be95a6390 e44a230b2031 26573864b711 f396385663c0 (Wikimedia Commons, "Mahmudabad, Mazandaran 01-04.ogv", Mostafameraji, CC0) out/source-76s.mp4 62,415,506 bytes, 75.96 s, 1920x1080, 25 fps, H.264 CRF 27 + constructed 440 Hz sine as AAC 128 kbps 502ea58550b6 (build.sh: the four clips scaled, joined) out/source-19s.mp4 22,584,379 bytes, 19.08 s, same settings 2015a2988230 Tool: https://koldflux.com/tools/video/compress, headless Chromium (Playwright, tool-run.cjs), one fresh page per run. 1 MB = 1,000,000 bytes. Sizes are the downloaded files (wc -c). ffprobe: every output is H.264 + AAC, 852x480, 1280x720 or 1920x1080, same duration as the source. == A. Tool presets (run-tool-76.log, run-tool-19.log). seconds = time the tool took in the browser on a 8-core server source-76s.mp4 480p 268.1 s 8,796,864 bytes 115,809 bytes/s source-76s.mp4 720p 450.2 s 18,919,057 bytes 249,066 bytes/s source-76s.mp4 1080p 798.8 s 43,511,698 bytes 572,824 bytes/s source-19s.mp4 480p 76.3 s 3,191,494 bytes 167,269 bytes/s source-19s.mp4 720p 135.6 s 7,150,329 bytes 374,755 bytes/s source-19s.mp4 1080p 228.1 s 16,325,949 bytes 855,658 bytes/s Control: source-19s at 480p run a second time (for the screenshot): 3,191,494 bytes again, identical. == B. ESTIMATED seconds of this footage that fit (limit / bytes per second of the 76 s run, rounded down; nothing longer than 76 s was encoded). Same arithmetic on the 19 s clip: 480p 149 s / 119 s, 720p 66 s / 53 s, 1080p 29 s / 23 s (1080p 855,658 vs 572,824 bytes/s, 720p 374,755 vs 249,066, i.e. 1.5x) 25 MB 20 MB 480p 215 s 172 s 720p 100 s 80 s 1080p 43 s 34 s (whole 76 s clip: 480p 8.80 MB, 720p 18.92 MB, 1080p 43.51 MB; 720p fits both limits, 1080p fits neither) The two clips are from one source and differ: 1080p bytes/s is 572,824 on the 76 s clip and 855,658 on the 19 s clip (1.49x). The 19 s source file (22,584,379 bytes) fits Gmail (90.3% of 25 MB) and is over Discord (112.9% of 20 MB). == C. Two-pass script to-limit.sh (97% of the limit, 128 kbps AAC; the script is a draft setting, not a platform figure) source-76s 25 MB video 2425 kbps 24,384,068 bytes 97.5% of limit 1920x1080 132.75 s to encode source-76s 20 MB video 1915 kbps 19,556,591 bytes 97.8% of limit 1920x1080 112.04 s source-76s 20 MB, height 720 video 1915 kbps 19,482,640 bytes 97.4% 1280x720 source-19s 20 MB video 8006 kbps 19,361,943 bytes 96.8% (non-ASCII file names) Ground truth: fit.py (ffprobe duration, wc -c bytes) for every row above; no number on the page comes from the tool's own text. == D. Edge cases (commands.log has the commands, exit codes and messages) missing file: exit 1; empty file: exit 1; limit not a number: exit 1; limit 0.2 MB for 75.96 s: exit 1 (video bitrate would be -107 kbps); non-ASCII names: ok; input without an audio track: ok (19,056,105 bytes at 20 MB); script saved with Windows line breaks: exit 2 "set: pipefail: invalid option name", fixed by sed 's/\r$//' (then ok). Not tested: Windows PowerShell, macOS Terminal run of the script, a phone, uploading to Gmail or Discord, Slack, Outlook, WhatsApp, Telegram. == E. Cross-checks Source clip 62,415,506 bytes = 62.4 MB (62.42). 1080p bytes per second 855,658 / 572,824 = 1.49 (about 1.5 times). 720p preset: 249,066 bytes/s x 8 = 1,992 kbps including audio. Koldflux video bitrate calculator (https://koldflux.com/tools/calculators/video-bitrate, run 2026-11-26 in headless Chromium): 25 MB, 75.96 s, 128 kbps -> total 2,761 kbps, video 2,633 kbps; it counts 1 MB = 1,048,576 bytes (26,214,400 bytes for 25). to-limit.sh uses 1,000,000 and 97%: video 2,425 kbps. Tool pages for Gmail and Discord (read 2026-11-26): 480p 7 min 58 s / 6 min 22 s, 720p 5 min 9 s / 4 min 7 s, 1080p 2 min 51 s / 2 min 17 s (25 MB / 20 MB), from their own test clips at 273-290, 485-519 and 812-1,039 kbps; ours differ because the footage differs. Calculator advice check: 23.8 MB x 1,048,576 = 24,956,109 bytes, under 25,000,000. == F. Fix round (2026-11-26). to-limit.sh now stops on no duration (exit 1) and leaves a file already under the limit alone (exit 0, message). Re-run: 76 s clip at 25 MB still 2425 kbps, 24,384,068 bytes; noaudio 19 s at 20 MB 19,056,105 bytes; small 1,423,206-byte clip at 25 MB: no output (was 13,323,357 bytes); nodur.webm exit 1. Edge cases are now 11, all in commands.log.