Checks a video file against the upload limits TikTok, YouTube Shorts, Instagram Reels and Facebook Reels publish, before you post it.
It reads the file with ffprobe and prints every check as pass, warn, fail, unknown or info, with the page the figure comes from. Each
figure in data/upload-specs.json quotes that page and the date it was read. A command line tool, a GitHub
Action and a JavaScript module, with no dependencies.
Needs Node 18 or newer and FFmpeg (ffprobe on your PATH: brew install ffmpeg, sudo apt install ffmpeg, or
https://ffmpeg.org/download.html).
npx github:viewgum/shortform-preflight my-short.mp4
npx github:viewgum/shortform-preflight my-short.mp4 --route web
npx github:viewgum/shortform-preflight my-short.mp4 --api --tiktok-endpoint direct --tiktok-max-seconds 600
npx github:viewgum/shortform-preflight renders/*.mp4 --platform tiktok,youtube-shorts --json| Option | What it does |
|---|---|
--platform <ids> |
Comma-separated: tiktok, youtube-shorts, instagram-reels, facebook-reels, or all on its own. Default: all four. |
--route <route> |
app (uploads in the phone app, the default), web (uploads on the website) or api (the publishing APIs that posting and scheduling tools use). |
--api |
The same as --route api. |
--tiktok-endpoint <name> |
TikTok API endpoint. Use upload (default) or direct for Direct Post. |
--tiktok-max-seconds <n> |
Direct Post uses the account's max_video_post_duration_sec. Without it the check is incomplete and exits 1. |
--json |
JSON: an object for one file, an array for several. Every row carries its source and the page's own words. |
--markdown |
Markdown tables, as written to a GitHub job summary. |
--loudness |
Also measure integrated loudness and true peak with FFmpeg's ebur128 filter. Reported only: none of these pages gives a loudness figure. |
--safe-zones |
Print where to find safe zones for text placement. |
Exit codes: 0 when every check passed or warned, 1 when a check failed or a limit on the route could not be read from the file,
2 for bad input (a missing file, a still image, no ffprobe, an unknown platform, route or option), with a one-line message on
stderr. Set FFPROBE_PATH and FFMPEG_PATH to use binaries that are not on your PATH.
A 95 second 1080 x 1920 clip at 23.976 fps, written by FFmpeg with its default settings:
$ npx github:viewgum/shortform-preflight demo-1080x1920.mp4 --api --platform instagram-reels,facebook-reels
demo-1080x1920.mp4
MP4, 1080 x 1920 (9:16), 95.012 s, 23.976 fps, H.264 4:2:0, AAC (LC) 44.1 kHz stereo, 72.2 MB
Rules for the publishing APIs.
Instagram Reels: fail
pass length 95.012 s 3 s to 15 min api [1]
pass container MP4 MOV or MP4 api [1]
fail edit list present no edit lists api [1]
fail moov atom after the media moov atom at the front api [1]
pass video codec H.264 HEVC or H.264 api [1]
pass scan progressive progressive api [1]
pass chroma 4:2:0 (yuv420p) 4:2:0 api [1]
pass frame rate 23.976 fps 23 to 60 fps api [1]
pass width 1080 px at most 1920 px wide api [1]
pass aspect ratio 9:16 0.01:1 to 10:1 api [1]
info aspect ratio 9:16 9:16 api [1]
pass video bitrate 5.94 Mbps at most 25 Mbps api [1]
pass file size 72.2 MB at most 300MB api [1]
pass audio codec AAC (LC) AAC api [1]
pass sample rate 44.1 kHz at most 48 kHz api [1]
pass channels 2 (stereo) mono or stereo api [1]
info audio bitrate 132.1 kbps listed as 128kbps api [1]
Facebook Reels: fail
fail length 95.012 s 3 to 90 s api [2]
info container MP4 MP4 api [2]
pass aspect ratio 9:16 9:16 to 16:9 api [2]
pass aspect ratio 9:16 9:16 api [2]
pass shorter side 1080 px shorter side at least 540 px api [2]
pass longer side 1920 px longer side at least 960 px api [2]
info frame size 1080 x 1920 1080 x 1920 api [2]
fail frame rate 23.976 fps 24 to 60 fps (average) api [2]
pass video codec H.264 H.264, H.265, VP9 or AV1 api [2]
pass chroma 4:2:0 (yuv420p) 4:2:0 api [2]
pass scan progressive progressive api [2]
pass audio codec AAC (LC) AAC api [2]
pass AAC profile LC Low Complexity api [2]
warn sample rate 44.1 kHz 48 kHz api [2]
pass channels 2 (stereo) stereo api [2]
pass audio bitrate 132.1 kbps 128 kbps or more api [2]
Sources
[1] Meta for Developers: IG User Media, checked 2026-11-19
https://developers.facebook.com/documentation/instagram-platform/instagram-graph-api/reference/ig-user/media
[2] Meta for Developers: Reels Publishing API, checked 2026-11-19
https://developers.facebook.com/documentation/video-api/guides/reels-publishing
4 fail, 1 warn, 24 pass, 4 info
FFmpeg's MP4 output carries an edit list and writes the moov atom after the media, and Instagram's Reel specifications ask for
neither; -movflags +faststart -use_editlist 0 fixes both (see below). 23.976 fps is under the 24 fps Facebook's Reels API asks for,
which is easy to miss with film-rate footage.
The platforms publish different figures for uploading in the phone app, uploading on the website and posting through their APIs, so
every figure here is tagged with its route, the way data/length-limits.json keeps maxSeconds (the app)
apart from webMaxSeconds, apiMinSeconds and apiMaxSeconds.
- By default the checks use the app figures.
--route webuses the web figures, and--apithe API figures. - TikTok publishes a length for phone app uploads (60 minutes) and a format, picture size, length and file size for web uploads in
TikTok Studio. Instagram and Facebook publish app figures in their help pages and newsroom, and API figures in their developer docs.
Instagram's, Facebook's and YouTube's pages do not split app and web uploads, so their app figures also apply to
--route web. - Where an app or web check has no figure of its own, the API figure is used, shown as
api*, and it warns instead of failing. - YouTube's Shorts rule (square or vertical, up to three minutes) covers any upload, shown as
any.
What the results mean:
- fail: outside a limit for the route you checked. A limit is a figure the page states as a maximum, minimum, range, required value or list of accepted formats, or one the platform enforces with a listed API error.
- unknown: a limit that could not be verified, such as an unreadable video bitrate, a missing Direct Post account maximum, or a TikTok Studio file size between 10 GB and 10 GiB. An unverified limit makes the result incomplete and the run exits 1.
- warn: outside a figure the page lists as a setting or words as advice ("should"), a figure the page gives for a nearby case (Instagram's 20 minutes for recording and editing), or an API figure on an app or web check. A file size also warns if it fits only the 1024-based reading of a limit such as TikTok's "4GB" or Instagram's "300MB". A bitrate up to 1% under a floor warns too.
- info: a recommendation, such as YouTube's encoding settings (with a note when the file differs from it), or a figure listed with no minimum or maximum. Never a fail.
app, web, api and any give the route. The result in brackets is what a file outside the figure gets on that route.
| Check | TikTok | YouTube Shorts | Instagram Reels | Facebook Reels |
|---|---|---|---|---|
| Length | app: up to 60 min (fail); web: up to 30 min (fail); api: 10 min for Upload (fail), account maximum for Direct Post (fail) | any: up to 3 min (fail) | app: 20 min for recording and editing (warn); api: 3 s to 15 min (fail) | app: no limit; api: 3 to 90 s (fail) |
| Shape | any: square or vertical (fail) | app: 9:16 to 1.91:1 (fail); api: 0.01:1 to 10:1 (fail), 9:16 (info) | app: no format restriction; api: 9:16 to 16:9 (fail), 9:16 (warn) | |
| Picture size | web: at least 720 x 1280 in either orientation (fail); api: 360 to 4096 px each side (fail) | app: shorter side at least 720 px (warn); api: at most 1920 px wide (fail) | api: at least 540 x 960 (fail); 1080 x 1920 (info) | |
| Frame rate | api: 23 to 60 fps (fail) | app: at least 30 fps (warn); api: 23 to 60 fps (fail) | api: 24 to 60 fps average (fail) | |
| Container | web: MP4 or WebM (fail); api: MP4, WebM or MOV (fail) | any: MP4 (info) | api: MOV or MP4 (fail) | api: MP4 (info) |
| Video codec | api: H.264, H.265, VP8 or VP9 (fail) | any: H.264, High Profile (info) | app: H.264 High profile (warn); api: HEVC or H.264 (fail) | api: H.264, H.265, VP9 or AV1 (warn) |
| Chroma, scan | any: 4:2:0, progressive (info) | app: 4:2:0, progressive (warn); api: 4:2:0, progressive (fail) | api: 4:2:0, progressive (warn) | |
| Edit lists, moov atom | any: none, at the front (info) | api: none, at the front (fail) | ||
| Video bitrate | any: YouTube's table by size and frame rate (info) | api: at most 25 Mbps (fail) | ||
| File size | web: under 10 GB (fail); api: 4GB (fail) | app: 256 GB (fail); api: 274,877,906,944 bytes (fail) | api: 300MB (fail) | |
| Audio codec | any: AAC-LC, Opus or Eclipsa Audio (info) | api: AAC (fail) | api: AAC Low Complexity (warn) | |
| Sample rate | any: 48 kHz (info) | app: 48 or 96 kHz (warn); api: at most 48 kHz (fail) | api: 48 kHz (warn) | |
| Channels | api: mono or stereo (fail) | api: stereo (warn) | ||
| Audio bitrate | any: 128 kbps mono, 384 stereo, 512 for 5.1 (info) | api: listed as 128kbps (info) | api: 128 kbps or more (fail, warn within 1% under) |
Readings to know about:
- Facebook's 540 x 960 and TikTok Studio's 720 x 1280 minimums apply to the shorter and longer sides in either orientation. Instagram's 720 pixel recommendation applies to the shorter side.
- For TikTok Studio, files below 10,000,000,000 bytes pass. From that byte count up to but excluding 10 GiB, the result is unknown because TikTok does not say how it counts GB. At 10 GiB or above, the file fails.
- TikTok's Upload endpoint accepts up to 10 minutes. For Direct Post, use
--api --tiktok-endpoint directand supply the account's maximum with--tiktok-max-seconds. - Instagram Help offers its codec and audio details as extra help ("The requirements listed above should work for most people"), so they warn. Its 20 minute figure is for recording and editing in the app, so it warns too. Instagram's developer page lists "no edit lists" and "moov atom at the front" in its Reel specifications, so API checks fail them.
- YouTube's bitrate table is by "1080p" and so on; the row is the one that matches the frame's shorter side, so 1080 x 1920 reads the 1080p row, and a size or frame rate the table does not list gets no row. 23.976, 29.97 and 59.94 fps count as 24, 30 and 60.
- A bitrate passes only at or over the figure; up to 1% under warns, since a stream encoded at 128k often averages a little under.
- The video bitrate is the stream's own figure, summed from its packets when the file does not store one (WebM and MKV). A JSON
probe passed to
normalize()needs a video stream bitrate to verify a maximum. - YouTube's audio recommendation includes Eclipsa Audio. An IAMF track tag or stream group identifies it. If the AAC profile or audio format cannot be read, the recommendation stays informational and unverified.
- WebM and Matroska are told apart by the DocType in the file's header, never by its name.
- Shape uses the display orientation and sample aspect ratio. The Instagram API checks its 1920-column limit against the encoded width before rotation.
- A file with no audio stream gets one info row; none of these pages requires audio. A still image (PNG, JPEG and the like) is not a video and exits 2.
Sources checked on 2026-11-19.
- TikTok Support: Camera tools (Video length) and Tools for creators (Upload, on a web browser)
- TikTok for Developers: Media Transfer Guide (Video restrictions) and
Query Creator Info (
max_video_post_duration_sec) - YouTube Help: Understand three-minute YouTube Shorts, Upload videos longer than 15 minutes (Maximum upload size) and YouTube recommended upload encoding settings
- Google for Developers: YouTube Data API discovery document (
videos.insert.mediaUpload.maxSize) - Instagram Help: Reel size & aspect ratios on Instagram and Record a reel on Instagram
- Meta for Developers: IG User Media (Reel Specifications)
- Meta Newsroom: Making it Easier to Create Videos on Facebook (June 17, 2025)
- Meta for Developers: Reels Publishing API (Video Specifications and error codes)
- Read and not used: TikTok Business Help, TikTok Auction In-Feed Ads. Its figures are for ads, not posts.
Checks every video file that the files globs match in the checked-out repository (all of them, not only the files a pull request
changed) and writes the tables to the job summary. It installs FFmpeg on Ubuntu runners if it is missing.
name: preflight
on:
pull_request:
paths: ["videos/**"]
jobs:
preflight:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: viewgum/shortform-preflight@main
with:
files: |
videos/**/*.mp4
videos/**/*.mov
platforms: tiktok,youtube-shorts,instagram-reelsThe paths filter only decides when the workflow runs; the step still checks every file under videos/ that the globs match.
| Input | Default | What it does |
|---|---|---|
files |
(required) | One path or glob per line. * matches within a name. A ** path segment matches any folder depth, including zero. The step skips empty matches with a notice and fails if no line matches a file or a plain path is missing. |
platforms |
all four | Comma-separated platform ids. |
route |
app |
app, web or api. |
api |
false |
true is the same as route: api. |
tiktok-endpoint |
upload |
TikTok API endpoint, upload or direct. |
tiktok-max-seconds |
Account maximum in seconds for Direct Post. | |
loudness |
false |
true adds the loudness measurement. |
fail-on |
fail |
fail fails the step when a check fails or a limit could not be read; none reports and passes. |
The result output is 0 when every check passed or warned, and 1 when a check failed or a limit could not be read. Bad input (a
missing file, a still image, an unknown platform) fails the step whatever fail-on says.
npm install github:viewgum/shortform-preflightimport { probe, check, normalize, uploadSpecs } from "shortform-preflight";
const result = check(probe("my-short.mp4"), { platforms: ["youtube-shorts", "tiktok"], route: "app" });
result.ok; // false when a check failed or a limit could not be read
result.complete; // false when a limit could not be read
result.platforms[0].rows[0]; // { check, status, shown, rule, route, kind, note, quote, source, ... }
// check() is pure. normalize() takes ffprobe JSON you already have (-show_format -show_streams).
check(normalize(ffprobeJson, { file: "my-short.mp4" }), { route: "api", tiktokEndpoint: "direct", tiktokMaxSeconds: 600 });probe() runs ffprobe, reads the MP4 or MOV box layout (moov position, edit lists) and a Matroska file's DocType, and sums the
video stream's packets when the file stores no bitrate for it. Types are in index.d.ts.
# Move the moov atom to the front and leave out edit lists, without re-encoding
ffmpeg -i in.mp4 -c copy -movflags +faststart -use_editlist 0 out.mp4
# H.264 at 4:2:0 with 48 kHz AAC, moov at the front
ffmpeg -i in.mov -c:v libx264 -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 192k -movflags +faststart out.mp4FFmpeg's MP4 output often carries edit lists, as in the example above. -use_editlist 0 leaves them out; check the audio sync of the result.
- What is in the video: content, policy, captions, music rights.
- Where text sits. Safe zones for all four apps are in https://github.com/viewgum/short-form-video-specs
- Closed GOP, B frames, CABAC and a fixed frame rate: they need a frame by frame read of the stream. The H.264 profile is read and checked where a page names one (Instagram's app details, YouTube's recommendations).
- Each TikTok account's own maximum length, unless you give it with
--tiktok-max-seconds. - Figures the pages do not give: TikTok's app picture size and file size, Instagram's upload length in the app, Facebook's file size and video bitrate.
- Recording limits (TikTok's 10 minutes in its camera): they are not upload figures.
- Whether a platform accepts or re-encodes a file anyway. These are the published figures, not a test upload.
Code: MIT. ViewGum's compilation and its own text in data/: CC BY 4.0, credit "ViewGum, viewgum.com". The quoted excerpts
from platform pages belong to their publishers and are not covered by either license. See LICENSE.
data/length-limits.json is the same file as in
short-form-video-specs, and the tests check it agrees with
data/upload-specs.json.
If a platform changes a figure, or a figure here does not match its page, open an issue with the page, its exact words and the date you read it.
Maintained by ViewGum (https://viewgum.com).