Skip to content

Instantly share code, notes, and snippets.

@dgnsrekt
Created November 11, 2019 12:40
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 dgnsrekt/5bd7326b531997ee00034e45cc9db2ea to your computer and use it in GitHub Desktop.
Save dgnsrekt/5bd7326b531997ee00034e45cc9db2ea to your computer and use it in GitHub Desktop.
import nox
from pathlib import Path
PROJECT_ROOT_DIR = Path(__file__).parent
PROJECT_BIN_DIR = PROJECT_ROOT_DIR / "bin"
FFMPEG_DIR = PROJECT_BIN_DIR / "ffmpeg-stable"
DOWNLOAD_COMPRESSED_FILE = "ffmpeg-git-amd64-static.tar.xz"
DOWNLOAD_URL = "https://johnvansickle.com/ffmpeg/builds/" + DOWNLOAD_COMPRESSED_FILE
FFMPEG_BIN = FFMPEG_DIR / "ffmpeg"
@nox.session(python=False)
def ffmpeg(session):
"""
Downloads and runs ffmpeg stable binary.
"""
if not PROJECT_BIN_DIR.exists():
PROJECT_BIN_DIR.mkdir(exist_ok=True)
if not FFMPEG_DIR.exists():
FFMPEG_DIR.mkdir(exist_ok=True)
if not FFMPEG_BIN.exists():
session.run("wget", "--verbose", "--no-clobber", DOWNLOAD_URL, external=True)
session.run(
"tar",
"-xf",
DOWNLOAD_COMPRESSED_FILE,
"-C",
str(FFMPEG_DIR),
"--strip-components",
"1",
external=True,
)
session.run("rm", DOWNLOAD_COMPRESSED_FILE, external=True)
session.run(FFMPEG_BIN, "-version")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment