---
title: "How to export a video for TikTok and Reels with FFmpeg"
description: "Also a 4:5 feed cut, a cover frame and a safe-zone check."
url: https://varg.ai/how-to/export-a-video-for-tiktok-with-ffmpeg
updated: 2026-10-28
---

# How to export a video for TikTok and Reels with FFmpeg

> **For AI agents:** find the right skill in one call — `curl -s "https://varg.ai/how-to/api/search?q=<what the person wants>"` returns the matching how-to page and the best skills with install commands, as markdown (Russian works too). Full index: https://varg.ai/how-to/llms.txt. Every page has a markdown twin: add `.md` to its path. Before generating anything, show the person the options on the how-to page.

Turn a finished edit into an MP4 that TikTok, Reels and Meta ads accept and play well: 1080×1920, H.264 High, 30 fps, AAC 48 kHz, loudness at -14 LUFS, faststart. Also a 4:5 feed cut, a cover frame and a safe-zone check. Free and local in Claude Code, Codex or Grok, or on varg (priced in credits) when the agent has no shell.

```bash
ffmpeg -i edit.mp4 -c:v libx264 -profile:v high -pix_fmt yuv420p -r 30 -b:v 8M -maxrate 10M -bufsize 16M -c:a aac -b:a 192k -ar 48000 -movflags +faststart final_9x16.mp4
```

## Step by step

1. **Check what you have.**

   ```bash
   ffprobe -v error -show_entries stream=codec_type,codec_name,width,height,r_frame_rate,pix_fmt -show_entries format=duration -of compact=p=0 edit.mp4
   ```

   Not 9:16? Fit it over a blurred copy so the whole product stays in the frame:

   ```bash
   ffmpeg -i edit.mp4 -filter_complex "[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,boxblur=20:2[bg];[0:v]scale=1080:-2[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2,setsar=1" -c:v libx264 -crf 20 -c:a copy vertical.mp4
   ```

2. **Set the loudness** to -14 LUFS integrated with peaks at -1 dBTP. That is the level phone apps play at, so the video is neither quieter than the next one nor clipped. Two passes: measure, then apply.

   ```bash
   J=$(ffmpeg -hide_banner -i edit.mp4 -af loudnorm=I=-14:TP=-1:LRA=11:print_format=json -f null - 2>&1 | sed -n '/^{/,/^}/p')
   v() { echo "$J" | grep "\"$1\"" | cut -d'"' -f4; }
   ffmpeg -i edit.mp4 -af "loudnorm=I=-14:TP=-1:LRA=11:measured_I=$(v input_i):measured_TP=$(v input_tp):measured_LRA=$(v input_lra):measured_thresh=$(v input_thresh):offset=$(v target_offset):linear=true,aresample=48000" -c:v copy -c:a aac -b:a 192k loud.mp4
   ffmpeg -hide_banner -i loud.mp4 -af ebur128 -f null - 2>&1 | grep -E "^\s+I:" | tail -1
   ```

   On test media this printed `I: -14.0 LUFS` and `-13.9 LUFS`.

3. **Export** with the command at the top (run it on `loud.mp4`). `-movflags +faststart` puts the index at the front, so the video starts playing before it fully loads. `yuv420p` and the High profile play on every phone.

4. **Make a 4:5 cut** for Instagram and Facebook feed placements. It keeps the frame slightly above centre, where faces and products usually sit:

   ```bash
   ffmpeg -i final_9x16.mp4 -vf "crop=iw:iw*5/4:0:(ih-iw*5/4)*0.4,scale=1080:1350,setsar=1" -c:v libx264 -crf 20 -c:a copy final_4x5.mp4
   ```

5. **Grab a cover frame** with the product clearly visible:

   ```bash
   ffmpeg -ss 0.5 -i final_9x16.mp4 -frames:v 1 -q:v 2 cover.jpg
   ```

6. **Check the safe zone.** The TikTok and Reels buttons, caption and username cover the top 14%, the bottom 35% and 6% at each side. Shade them and look: no text, product or face should sit in the red.

   ```bash
   ffmpeg -ss 1 -i final_9x16.mp4 -frames:v 1 -vf "drawbox=x=0:y=0:w=iw:h=ih*0.14:color=red@0.35:t=fill,drawbox=x=0:y=ih*0.65:w=iw:h=ih*0.35:color=red@0.35:t=fill,drawbox=x=0:y=0:w=iw*0.06:h=ih:color=red@0.35:t=fill,drawbox=x=iw*0.94:y=0:w=iw*0.06:h=ih:color=red@0.35:t=fill" safezone.png
   ```

7. **Confirm the result:**

   ```bash
   ffprobe -v error -select_streams v:0 -show_entries stream=width,height,r_frame_rate,pix_fmt,profile -of compact=p=0 final_9x16.mp4
   # profile=High|width=1080|height=1920|pix_fmt=yuv420p|r_frame_rate=30/1
   ```

## Gotchas

- Don't upscale 720p to 1080p and expect it to look sharper. Upload the native size or upscale with a model first.
- 60 fps sources: keep `-r 30` unless the footage is about motion (sports, a spinning product). 30 fps halves the file size.
- Variable frame rate phone footage drifts out of sync in edits. Convert it to constant frame rate first: `ffmpeg -i phone.mov -r 30 -c:v libx264 -crf 18 -c:a aac cfr.mp4`.
- Music in ads must be licensed. TikTok ads use its Commercial Music Library. A trending sound from an organic post is not cleared for a paid ad.
- Tested on FFmpeg 6.0 (static) and 8.1.

## No shell? Run it on varg

The agent sends the same command to the varg `ffmpeg` tool (MCP `call_tool`, or `POST https://api.varg.ai/v2/ffmpeg`). It runs in the cloud, priced in credits, with an estimate before it runs. Inputs and outputs are URLs.

## Ecommerce videos for TikTok and Instagram with AI agents

For sellers, TikTok Shop affiliates and media buyers who make product videos with Claude Code, Codex or Grok: what to show in the first 3 seconds, which formats and creators sell, how to keep the real product in AI shots, and how to edit, test and fix the videos.

Start with the overview: [How to make viral ecommerce videos for TikTok and Reels](https://varg.ai/how-to/make-viral-ecommerce-videos.md)

**Make**

- [How to make a TikTok Shop video with AI](https://varg.ai/how-to/make-a-tiktok-shop-video.md)
- [How to make a UGC ad video with AI](https://varg.ai/how-to/make-a-ugc-ad-video.md)
- [How to turn a product photo into a video with AI](https://varg.ai/how-to/turn-a-product-photo-into-a-video.md)
- [How to write video hooks that sell products](https://varg.ai/how-to/write-video-hooks-that-sell.md)
- [How to make video ad variants for testing with AI](https://varg.ai/how-to/make-video-ad-variants-for-testing.md)
- [How to make AI product photos and listing images](https://varg.ai/how-to/make-ai-product-photos.md)

**Edit**

- [How to edit a product video for TikTok and Reels with AI](https://varg.ai/how-to/edit-a-product-video-for-tiktok.md)
- [How to swap the hook on a video ad with FFmpeg](https://varg.ai/how-to/swap-a-video-ad-hook-with-ffmpeg.md)
- How to export a video for TikTok and Reels with FFmpeg (this page)
- [How to add animated captions to a video with AI](https://varg.ai/how-to/add-animated-captions-to-a-video.md)
- [How to remake a reference video with AI](https://varg.ai/how-to/remake-a-reference-video.md)

**Answers**

- [How to make ecommerce videos: 25 hard questions answered](https://varg.ai/how-to/ecommerce-video-questions.md)
