What the code relies on from each platform's official docs, last read on 2026-10-31, and the TikTok and YouTube upload pages and the registration pages on 2026-11-01. These rules change, so recheck the source before relying on a detail.
- Init:
POST https://open.tiktokapis.com/v2/post/publish/inbox/video/init/, scopevideo.upload, 6 requests per minute per token. - Body:
source_infowithsource: FILE_UPLOAD,video_size,chunk_sizeandtotal_chunk_count. - Response:
data.publish_id,data.upload_urlanderror.code, which isokon success. - The video init has no
post_infofield, so inbox mode can't send a caption. The creator finishes the post in TikTok. - At most 5 pending shares in any 24 hours. Past that, init returns 403
spam_risk_too_many_pending_share.
PUT upload_urlwithContent-Type(video/mp4,video/quicktimeorvideo/webm),Content-LengthandContent-Range: bytes FIRST-LAST/TOTAL.total_chunk_countisvideo_size / chunk_size, rounded down.- Each chunk is 5-64 MB and the final chunk can reach 128 MB, with 1-1000 chunks sent in order.
- A file under 5 MB goes in one request with
chunk_sizeset to the file size. A file over 64 MB must be split. upload_urlis valid for one hour. An expired URL returns 403, an unknown one 404, and a range mismatch 416.- Every chunk but the last returns 206, and only 201 means the whole file arrived. A 400 means malformed headers or a wrong
Content-Length. A 5xx means retry the same chunk. - The response carries
Content-Range: bytes 0-{UPLOADED_BYTES}/{TOTAL_BYTE_LENGTH}. The docs don't say whether that number is a position or a count, so the app accepts either and starts over only if it's behind the chunk just sent. - The docs give no way to resume, and don't say how to recover from a 416. So the app starts again under a new init, once per upload. Whether an abandoned init counts against the 5 pending shares isn't stated.
- The docs don't say whether MB is decimal or binary, though the media guide's own example (4 MB is 4,194,304 bytes) reads as binary. The 16 MiB chunks are inside the limits either way. The 4 GB limit is checked as binary, so TikTok's own answer settles a file between 4,000,000,000 bytes and 4 GiB.
MP4 (recommended), WebM or MOV. H.264 (recommended), H.265, VP8 or VP9. 23-60 FPS, 360-4096 pixels per side, up to 10 minutes and 4 GB.
POST /v2/post/publish/status/fetch/withpublish_id, 30 requests per minute per token.- Statuses:
PROCESSING_UPLOAD,SEND_TO_USER_INBOX,PUBLISH_COMPLETE(in inbox mode, the creator posted the draft) andFAILED. internalis the fail reason TikTok says to retry.auth_removed,spam_risk,spam_risk_textandspam_risk_user_banned_from_postingmust not be retried.spam_risk_too_many_postsmeans the creator passed the API's posting limit in 24 hours, so the app waits. The format, duration, frame rate and picture size failures don't state whether to retry, and the app treats them as final, since the same file would fail the same way.- Processing has no guaranteed time limit. The docs give averages of under 30 seconds for 512 MB, about a minute for 1 GB, and over two minutes for 4 GB.
- The field names on this page are
error.log_id, while the upload page sayserror.logidin its table. The app doesn't read either.
- Authorize at
https://www.tiktok.com/v2/auth/authorize/with PKCE. The challenge is the hex SHA256 of the verifier, not base64url. - The verifier is 43-128 unreserved characters, new for each request. TikTok's sample code uses
Math.random()and passes the verifier as the challenge, so don't copy it. - Redirect host is
localhostor127.0.0.1, and a port is required. A wildcard port is allowed:http://127.0.0.1:*/callback/. - Token endpoint:
POST https://open.tiktokapis.com/v2/oauth/token/. Exchange and refresh both requireclient_secret. - Access tokens last 24 hours and refresh tokens 365 days. A refresh can return a new refresh token, which replaces the old one.
- Revoke:
POST /v2/oauth/revoke/withclient_key,client_secretand the access token astoken. - On a failed sign-in the redirect carries
erroranderror_description. The docs liststateonly for success, so an error without a state is accepted, and an error with a wrong state is ignored. - Token errors use the fields
error,error_descriptionandlog_id, and the docs don't state the HTTP status.invalid_grantmeans the code or refresh token is invalid, expired or revoked.server_errorandtemporarily_unavailableare retryable. - The app requests
user.info.basic(display name, fromGET /v2/user/info/?fields=open_id,display_name) andvideo.upload.
- Apps must help authentic creators post original content, for a wide audience. A utility tool for accounts you or your team manage is not acceptable.
client_secretmust not be embedded in open-source projects, and apps must not add watermarks or promotional branding.- The guidelines don't address apps that each user registers themselves, and an app must be approved for
video.upload. Approval for an individual registration is not assured. - Unaudited clients are limited to 5 users per 24 hours and
SELF_ONLYposts. These rules are written for Direct Post, and the page doesn't mention inbox upload.
- A desktop redirect URI goes in Login Kit's product configuration. Up to 10 are allowed, each under 512 characters, and
http://127.0.0.1:*/callback/is one of the docs' examples. - The app page needs an icon (1024 x 1024), name, category and description, and a website address for the Desktop platform. Apps created after 2024-09-09 must verify the terms of service, privacy policy and website addresses.
- App review wants an explanation of each product and scope, and at least one demo video.
- Sandbox mode needs no review, and works on up to 10 target accounts you own. It "does not offer access to Content Posting API for public videos". The page doesn't mention
video.upload, so whether inbox uploads work there is unknown.
Fetch creator info, show the nickname, check max_video_post_duration_sec, offer privacy from privacy_level_options with no default, leave Comment, Duet and Stitch off, show the music declaration, leave the commercial content toggle off, show a preview, keep preset text editable, and send nothing without explicit consent.
videos.inserthas its own quota bucket of 100 calls per day. Other methods share 10,000 units per day, withplaylistItems.insertat 50 andplaylists.list,videoCategories.listandchannels.listat 1 each. Quotas reset at midnight Pacific.- Maximum file size is 256 GB. Media types are
video/*andapplication/octet-stream. - An omitted
privacyStatusdefaults topublic, so it is always sent. - The docs don't say whether starting a session or finishing one is what counts against the 100 calls. The app keeps its session so it doesn't start another needlessly.
- The
videos.insertpage doesn't listsnippet.categoryIdas required, but the errors page saysinvalidVideoMetadataoccurs when the title and category aren't both set. So the app sends category 22 (People & Blogs) when none is chosen.
Reasons are at error.errors[].reason.
403 quotaExceededand403 dailyLimitExceeded: wait until midnight Pacific.400 uploadLimitExceeded: the channel's own daily limit, separate from API quota. The docs give no reset time, so the app waits 24 hours.403 rateLimitExceeded,403 userRateLimitExceededand429 rateLimitExceeded: try again shortly.403 insufficientPermissions: connect the account again.401 authErrorand401 expired: replace the token once, then connect again.- Other 4xx are final.
snippet.title: 100 characters, no<or>.snippet.description: 5000 bytes, no<or>.snippet.tags[]: 500 characters in total. Commas count, and a tag with a space counts as if quoted.status.publishAt: ISO 8601, only withprivate. A time in the past publishes the video right away, so the validator rejects it.
The sources conflict. The videos.insert page says "Videos uploaded from unverified API projects are not restricted to private viewing mode." The revision history entry of 2020-07-28 says they are restricted, and no reversal turned up in the part of that page that was read. The app must compare the status.privacyStatus YouTube returns with the value requested, and warn when they differ.
- Start:
POST https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=...withX-Upload-Content-LengthandX-Upload-Content-Type. It answers 200, and the session URI comes back inLocation. - The docs' samples send
Authorizationon every chunk and status check, so the app does too, and only ever to an https address undergoogleapis.com. - Chunks are multiples of 256 KB, all the same size except the last.
- A 308 is YouTube's "keep going", not a redirect, so the upload client must not follow redirects.
- Status check: empty
PUTwithContent-Range: bytes */TOTAL. A 308 withRange: bytes=0-Ngives the bytes received, and noRangemeans none. HonorRetry-After. A finished upload gives the same answer it gave when it finished, so a lost final answer doesn't need a second upload. - Overlapping or skipping bytes means none of that request is taken, so the next chunk always starts from what
Rangesays. - Only 201 with the video resource means done. The app also accepts 200, which other Google upload docs use.
- Retry with backoff after no response, 500, 502, 503 or 504. Other codes are permanent. A 404 means the session expired and the upload starts again. The docs give no session lifetime.
videos.listwithpart=status, 1 unit per call.status.uploadStatusisuploaded,processed,failed,rejectedordeleted, withfailureReasonandrejectionReasongiving more.failureReasonuploadAbortedis treated as worth uploading again. The others would fail the same way.
playlistItems.insertneedsyoutube.force-ssland costs 50 units. AvideoNotFoundjust after uploading is treated as "not visible yet".videoAlreadyInPlaylistcounts as done, so the step is safe to repeat.playlists.listwithmine=truetakes up to 50 per page.videoCategories.listneedsregionCode. Only categories withsnippet.assignablecan be given to a video.
There is no API setting. YouTube's help says square or vertical videos up to three minutes, uploaded on or after 2024-10-15, are Shorts on standard channels. Official Artist Channels use 2025-12-08 for videos over one minute. Wider videos are long-form.
- Desktop app client type, loopback redirect
http://127.0.0.1:port, always PKCE. The S256 challenge is base64url, unlike TikTok. client_secretis listed as optional. Custom URI schemes and copy/paste flows are not supported.- An external app in "Testing" status gets refresh tokens that expire in 7 days. Tokens also stop working after six months unused, on revocation, or past 100 per client per account.
- Endpoints:
https://accounts.google.com/o/oauth2/v2/auth,https://oauth2.googleapis.com/tokenandhttps://oauth2.googleapis.com/revoke. Revoking removes every scope granted to the project. - The installed-apps guide doesn't say a loopback redirect may have a path, so the app uses
http://127.0.0.1:portwith none. - The same guide says
statecomes back in the URL fragment, which a local server can't see. The app reads it from the query string, as standard OAuth does. Confirm this at the first real sign-in.
- In Testing, only listed test users can sign in, up to 100, and their authorizations and refresh tokens end after seven days. Publish app on the Audience page moves a project to In production, for any Google account.
- Requesting sensitive or restricted scopes before verification shows the "unverified app" warning, and at most 100 new users can ever grant them. That cap can't be reset.
- Verification is optional for an app for personal use with under 100 users, who may click through the warning.
- The pages read don't say which class each YouTube scope falls in, so what the warning screen looks like for these scopes is still to be seen at the first real sign-in.
From the API discovery document, revision 20261029:
| Method | Scopes that allow it |
|---|---|
videos.insert |
youtube, youtube.force-ssl, youtube.upload, youtubepartner |
playlistItems.insert |
youtube, youtube.force-ssl, youtubepartner |
playlists.list |
youtube, youtube.force-ssl, youtube.readonly, youtubepartner |
channels.list |
youtube, youtube.force-ssl, youtube.readonly, youtubepartner, youtubepartner-channel-audit |
videoCategories.list |
youtube, youtube.force-ssl, youtube.readonly, youtubepartner |
The app always requests youtube.upload and youtube.readonly. Adding to a playlist needs youtube.force-ssl, which also allows deleting videos, comments and captions, so it is requested only when the user asks for playlist support. Google doesn't support incremental authorization for installed apps, so turning this on means connecting again.
Windows.Media.Transcoding and Windows.Media.Editing, as tried on 2026-11-01 from a published, unpackaged program. These come from trying them, not from their docs.
MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto)won't prepare a transcode, so the app starts from a named quality and sets every value itself.- The transcoder turns a sideways video upright by itself, but takes the size in the order the file stores it. Asking for 640 x 360 from a 640 x 360 file marked as turned a quarter gives an upright 360 x 640. Asking for 360 x 640 gives a sideways picture fitted into 640 x 360 with black bars.
MediaClipreports the size as viewers see it, and a composition takes it that way too, so the two disagree.MediaEncodingProfile.CreateFromFileAsyncreports it as stored. - The output has no rotation mark left in it, because the picture itself has been turned.
StorageFile.GetFileFromPathAsyncrefuses a relative path.- A background audio track longer than the video makes a file that lies. It reads as the video's length, then transcodes to something longer. Trim the track to the video.
MediaComposition.GetThumbnailAsyncleaves overlays out, so a frame can come back black where the rendered file is right.- An overlay bigger than the frame zooms into the picture, in the rendered file, as a fixed step for as long as the overlay lasts.
- HEVC rounds sizes: 720p came out 1280 x 736.
The library that reaches these tools, Microsoft.Windows.SDK.NET.dll, is 23 MB, and a framework-dependent single file can't be compressed. Listing only the needed types for CsWinRT to generate kept pulling in more of Windows. So the published program holds it zipped, at 6 MB, and loads it from memory on first use.
Read on 2026-11-01, and fetched that day through the app's own downloader: 9.0.2 arrived in 8 seconds, matched its checksum, and held exactly one ffmpeg.exe (105,423,872 bytes) and its LICENSE.
https://ffmpeg.org/download.htmlsays "FFmpeg only provides source code", and links to two builders for Windows: gyan.dev and BtbN.https://www.gyan.dev/ffmpeg/builds/release-versionanswers with the version as plain text, such as9.0.2.https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zipanswers 303 topackages/ffmpeg-9.0.2-essentials_build.zip, which is 114,768,076 bytes, withAccept-Ranges: bytes. Adding.sha256gives the checksum as bare hex.- The app asks for
packages/ffmpeg-{version}-essentials_build.zipby name, so the file and its checksum can't disagree if a new release appears midway. It doesn't parse the web page. - The essentials build includes libx264, and the builds are GPLv3, static and 64-bit. The smaller
.7zwould need a package to unpack, so the app uses the zip. - BtbN's automatic builds run daily, and its page doesn't mention a checksum file.
Tried on 2026-11-01 with FFmpeg 9.0.2 and Windows' tools, on made-up test pictures with heavy noise, not camera footage.
- Fit a size stayed under the limit every time, with both. A clip that's busy throughout came to 97–99% of the limit. Clips half flat and half busy came to 50–79%, because the flat half doesn't use its share. So it's a ceiling, not a target.
- Aiming at quality with FFmpeg can reach twice the estimate. It stops at twice the planned bitrate, and heavy noise goes all the way there: 39.7 MB against about 19 MB for Balanced at 1080p60. Windows' tools aim at the bitrate, and landed on it.
- Sideways videos stay upright with both, turned either way.
- H.264 refuses an odd size, such as 641×361. The app asks FFmpeg for an even one, even when it couldn't read the size itself. Scaling to a nearby size leaves pixels slightly out of square unless told otherwise, and players then report 639 wide.
- Windows' tools refuse an odd-sized source at the start, giving no reason beyond "Unknown". The same picture at an even size works. The message suggests FFmpeg or sending the file as it is.
- FFmpeg's last line is just "Conversion failed!" With
-v error, the first line says why. - Windows' MP4s keep their index at the end, and FFmpeg's at the front, as asked. It makes no difference to an upload.
- Odd file names are fine. Accents, Japanese,
%,#,&and brackets all went through, because arguments go straight to the program.
Tried on 2026-11-02 with Windows' tools, on test videos where each second is its own colour, so a picture says which second it came from. Not camera footage, and not yet with FFmpeg.
- WPF's own player can't play a composition, but it plays the source files, and seeks within them. So the preview plays the clips one after another from their own files, with a short pause, about 0.2 seconds here, where a clip comes from a different file.
- WPF's player, paused, sometimes keeps showing an earlier picture after a jump. At 1280 x 720 every jump landed. At 640 x 360 most showed the picture from before. Playing, it was always right. So the paused preview is a single frame read with
MediaComposition.GetThumbnailAsync, at about 0.4 seconds each. - WPF's player ignores the mark a phone leaves to show its video turned, and plays it sideways. The editor turns the player by the file's own rotation.
- Opened paused, WPF's player ignores a jump made straight after it opens, and plays from the start. Opened playing, it takes the jump.
GetThumbnailsAsync, for many frames at once, returned the first frame every time, whatever times it was asked for. Asked one at a time, the same frames came back right.- Windows' encoder can go seconds without a key frame on calm footage, and every reader then lands up to a second away from where it was asked to look.
CODECAPI_AVEncMPVGOPSizeon the profile's video properties sets the most frames between key frames. With a key frame every second, every frame was read right. The app asks for one every two seconds in what it makes. - A composition keeps cuts where they were asked for, turns a sideways phone video upright, fits a clip of another shape inside the frame with black bars, and joins a clip without sound to one with it.
- Windows' frame rate is reported from the file, and these short test files read as 31 fps rather than 30. A saved edit takes the first clip's figure.
Zoom, fades, crossfades, sounds and words, tried the same way on 2026-11-02:
VideoTransformEffectDefinitionfails in a composition with0xC00DA7FC, whether given a crop, an output size, both, or only a mirror. So zoom can't be a crop. Instead the clip is drawn as an overlay bigger than the frame, over black, which the frame then cuts off. Overlays keep a phone video upright.- An overlay is stretched to the rectangle it's given, not fitted inside it. So the app works out each clip's shape from the file, fits it, and then zooms that.
- An overlay has one opacity for all of it, so fades are black overlays in steps, about 12 a second, and a crossfade is the next clip as overlays in steps over the one before. Black steps cost little. A one-second crossfade added about 6 seconds to a two-second save, since each step opens the video again.
- A PNG's see-through parts stay see-through as an overlay. A half see-through green over blue came out as both mixed. So words are drawn as a PNG the size of the frame.
- An overlay from a trimmed video starts where it's trimmed to, when it's delayed, to the second.
- A clip's volume is one figure for the whole clip, with nothing for fades. So all the sound is mixed by the app instead: each stretch is read out of its file as WAV with
MediaTranscoder, the clips' own sound is turned off, and the mix goes in as the one background track. MediaTranscoder.TrimStopTimeis a time in the file, where Microsoft's documents say it's how much to leave off the end. Asked for 0.5 to 1 second, it gave half a second from 0.5.- Sound read out of an MP4 is about 2 ms late, 108 samples at 48 kHz, which is far less than a frame.
- A file's own profile names a sound track even for a video made silent, so a video's sound being there doesn't mean it's not silence.
- An M4A reads as a
MediaClip, so sounds are measured as videos are.
Speed and how quickly pictures are read, measured the same way on 2026-11-02, on 720p test videos:
MediaComposition.GetThumbnailAsynctakes about 420 ms a frame, and keeping the composition open doesn't help (it opens in 4 ms), so the time is in the call. Six asked at once took 1.6 seconds in all.MediaPlayerwithIsVideoFrameServerEnabled, kept open, jumps and hands over the frame in 15 to 25 ms: 16 ms each for 30 jumps in a row. It gave the same frame as the thumbnail at every moment tried, including on either side of a second's boundary, and turns a phone's video upright itself. Frames are copied withCopyFrameToVideoSurfaceinto aVideoFrame.CreateAsDirect3D11SurfaceBackedsurface, thenSoftwareBitmap.CreateCopyFromSurfaceAsync. The editor now reads its pictures this way, with the thumbnail only if the player can't open a video.- Nothing in a composition changes a clip's speed. But each MP4 track counts its frames' times in a unit of its own, set once in its
mdhdbox. Changing that unit in a copy, and the durations inmvhd,tkhdandelstto match, made a 5-second video play for 10 seconds with every second's colour where it should be, and Windows saved it at 30 frames a second, each frame shown twice. Double speed worked the same way. The copy's sound tracks are renamed tofree, since the sound is mixed separately. Nothing is re-encoded, so it's quick, but it only works for MP4 and MOV. - Sped up, that copy has more frames a second than the edit, and a composition got it wrong half the time. At 150% and 200%, about every other save took the copy's frames one after another instead of leaving every other one out, so the clip played at the old speed. Slowed down, it was right every time. Saving at 60 frames a second, or first making the sped-up part a video of its own at 30 with
MediaTranscoder, was right in every try. The editor does the second, for sped-up clips only, about 1.5 seconds for a two-second clip. MediaClip.Clonedidn't make a crossfade quicker: 12 steps took 4.5 seconds to save either way, against 0.36 seconds for two plain seconds. So crossfades now use 6 steps a second rather than 12.- Mixing a minute of three sounds took 0.9 seconds when each sample's volume was worked out on its own. It's now worked out each millisecond and filled in between.
- TikTok inbox upload
- TikTok media transfer
- TikTok post status
- TikTok upload getting started
- TikTok token management
- TikTok Login Kit for Desktop
- TikTok OAuth error handling
- TikTok user info
- TikTok Content Sharing Guidelines
- TikTok creating an app
- TikTok sandbox
- Google OAuth for installed apps
- YouTube videos.insert
- YouTube videos resource
- YouTube resumable uploads
- YouTube errors
- YouTube global errors
- YouTube playlistItems.insert
- YouTube playlists.list
- YouTube videoCategories.list
- YouTube videos.list
- YouTube quota costs
- YouTube API revision history
- YouTube Shorts help
- Google OAuth for native apps
- Google OAuth overview
- Google audience and publishing status
- Google OAuth app verification
- Google: when verification isn't needed
- FFmpeg's download page
- gyan.dev FFmpeg builds
- BtbN FFmpeg builds