halfsize

halfsize / X (Twitter)

Compress a video for X (Twitter)

X takes files up to 512 MB, then re-encodes almost everything you upload. The cap is rarely the problem; upload time and the second encode are. This is how to hand X a file it will not ruin.

The 512 MB cap is not the real limit

A three-minute 4K clip from a phone can pass 512 MB on its own, but most people hit a different wall first: upload bandwidth. A 400 MB file on a 10 Mbps uplink takes about five and a half minutes, and a dropped connection means starting over.

X also runs its own transcode. Feed it a file that already matches the output it wants — H.264 video, AAC audio, 1080p, +faststart — and the result survives with less damage than an oversized 4K source would.

One command

$ npx halfsize clip.mp4 --for twitter

  target     512 MB
  plan       H.264  1920x1080  21.8 Mbps  audio 128 kbps  2-pass
  output     clip.512mb.mp4

  1.24 GB  →  498 MB   2.5x smaller   2.7% under target
  VMAF 96.1   SSIM 0.992   looks the same

If you would rather upload in seconds, set your own target. X does not need 512 MB for a one-minute clip:

$ npx halfsize clip.mp4 --to 80mb

Vertical video

Phone footage is usually 1080×1920 with a rotation flag. The tool reads the flag and keeps the orientation, so the output is a real vertical file rather than a landscape video with metadata that some players ignore. Nothing is letterboxed.

What the re-encode does to quality

Measured on a 60-second 1080p30 source at 18 Mbps, with default settings:

TargetOutputResolutionVMAFVerdict
512 MB498 MB1920×108096.1looks the same
100 MB97.6 MB1920×108093.4looks the same
40 MB39.1 MB1280×72088.7slight softening

A single re-encode is not free. If you can upload a file that is already close to X's preferred format, the platform has less to throw away.

Format checklist for X

halfsize's defaults are exactly this list, which is why --for twitter is usually all you need.

FAQ

Does X really accept 512 MB?

That is the current per-video cap for standard accounts, and it changed more than once. Length limits depend on your account tier. Use --to with whatever number your account shows if it differs.

Should I upload 4K?

Only if the extra resolution matters more than upload time. X re-encodes to at most 1080p for most playback, so a clean 1080p file is the better trade.

Why did my video look worse after uploading?

X transcodes the file again. Starting from H.264, AAC, +faststart, with a bitrate that is not already starved, leaves the encoder less room to damage it.

Does it upload anything?

No. Encoding runs locally. Only the final upload to X moves the file anywhere.

Related guides