Skip to content

Instantly share code, notes, and snippets.

@positlabs
Created May 27, 2021 19: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 positlabs/8671e7b9eefdf480b53390d5128e7d05 to your computer and use it in GitHub Desktop.
Save positlabs/8671e7b9eefdf480b53390d5128e7d05 to your computer and use it in GitHub Desktop.
webm conversion for spark preview videos
#!/bin/bash
# https://trac.ffmpeg.org/wiki/Encode/VP9
# Converts video file to webm using two-pass encoding
# Installation on Mac: add script to /usr/local/bin
# Usage:
# webm ./path/to/video.mp4
# Outputs ./path/to/video.mp4.webm
# Max size is 720 pixels wide. Change -vf scale to adjust
# Set -crf to lower number for higher quality, longer encode time, and larger files. https://developers.google.com/media/vp9/settings/vod#quality
# -an strips audio, -c:a libopus copies audio
ffmpeg -i $1 -vf scale=720:-1 -c:v libvpx-vp9 -b:v 0 -crf 32 -pass 1 -an -f null /dev/null
ffmpeg -i $1 -vf scale=720:-1 -c:v libvpx-vp9 -b:v 0 -crf 32 -pass 2 -an $1.webm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment