Skip to content

Instantly share code, notes, and snippets.

@BrandonRomano
Created May 19, 2023 19:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrandonRomano/342467e0faa2cf54d22bf48a4c5206f5 to your computer and use it in GitHub Desktop.
Save BrandonRomano/342467e0faa2cf54d22bf48a4c5206f5 to your computer and use it in GitHub Desktop.
vcompress

vcompress

Include this in your bashrc / bash_profile:

function vcompress() {
    local base="$(basename "$1" .mp4)"
    ffmpeg \
      -i "$1" \
      -vf 'scale=if(gte(iw\,ih)\,min(1580\,iw)\,-2):if(lt(iw\,ih)\,min(1580\,ih)\,-2)' \
      "${base##*/}-compressed.mp4"
}

Usage:

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