Skip to content

Instantly share code, notes, and snippets.

@shirakaba
Last active June 21, 2022 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirakaba/a61a9fa307c21d53391c91e649b89366 to your computer and use it in GitHub Desktop.
Save shirakaba/a61a9fa307c21d53391c91e649b89366 to your computer and use it in GitHub Desktop.
Halve the size of a video, but properly

Use the flag:

-vf "scale='bitand(oh*dar, 65534)':'bitand(ih/2, 65534)', setsar=1"

For example (this also removes metadata and audio, and re-encodes at high quality):

ffmpeg -i landscape_safe_area_insets.mov -qscale 0 -vf "scale='bitand(oh*dar, 65534)':'bitand(ih/2, 65534)', setsar=1" -metadata location="" -metadata location-eng="" -an landscape_safe_area_insets.mp4

From: https://stackoverflow.com/a/49948025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment