Search code examples
ffmpegtiktok

FFMPEG Command to format videos to TikTok's specs?


I'm trying upload a video exported by windows video editor to tiktok. It's a .mp4 file, and while it does upload, it isn't "TikTok'd", meaning, it only takes up the middle of screen. I was wondering what the ffmpeg command would be to output a video to TikToks specs.

Here's how it currently looks.

TikTok bad format

And here's how I want it to look.

enter image description here


Solution

  • Use the crop filter to convert horizontal to vertical video:

    ffmpeg -i input.mp4 -vf "crop=ih*(9/16):ih" -crf 21 -c:a copy output.mp4
    
    • This will make it 9:16 aspect ratio.
    • -crf controls quality. See FFmpeg Wiki: H.264. 18-23 should be a good enough for a TikTok video.
    • Audio is stream copied (-c:a copy). If you get an error because your audio isn't compatible with MP4 then remove -c:a copy and AAC will be automatically used instead.