I shipped a Telegram bot that converts any video into a video avatar. The ffmpeg command took an afternoon. Getting every output under 2 MB took a week. The spec Telegram video avatars have rigid constraints: 800×800 pixels (square), H.264 codec, yuv420p pixel format, 10 seconds max, no audio, 2 MB file size ceiling, MP4 container with faststart. Miss any of these and Telegram silently rejects the file. No error message, no warning. The upload just fails. The resolution, codec, and duration rules are straightforward ffmpeg flags. The 2 MB ceiling is where things get interesting. The bitrate math 2 MB equals roughly 16.7 million bits. Over 10 seconds, that gives you about 1,677 kbps for everything: video stream, container overhead, metadata. I target 900 kbps for the video stream with a max rate of 1200 kbps. That produces roughly 1.1 MB for a 10-second clip. Plenty of headroom. Why not push closer to the limit? Because rate control isn't truly constant. Complex frames spike above the target.…