Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Forked from eribeiro/gource-ffmpeg.sh
Last active March 3, 2021 20:59
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 ryanmaclean/97de8973613f0bc8ddbf4d9f9d63883d to your computer and use it in GitHub Desktop.
Save ryanmaclean/97de8973613f0bc8ddbf4d9f9d63883d to your computer and use it in GitHub Desktop.
Run Gource on a git repo and generate a 4k movie file movie.mp4
#!/usr/bin/env bash
# Requirements:
# brew install gource libav ffmpeg
# Feel free to play around with these to test!
FILENAME="output" # mp4 extension is currently hardcoded
TITLE="Datadog Agent" # This title goes bottom left
FRAMERATE="25" # Pick 25, 30, 60
RESOLUTION="3840x2160" # Examples: 1920x1080, 3840x2160, 1280×720
REPO="https://github.com/DataDog/datadog-agent"
BKG="632CA6" # Colour from https://www.datadoghq.com/about/resources/
FONT_SIZE="32" # Looks OK at 4k, try ~20 for 1080p
cd # start at home (~)
# Clone repo then cd to dir
git clone "${REPO}"
cd "$(basename "${REPO}" .git)"
# Read the repo and generate gource video
function gource_output () {
gource \
-s .06 \
-"${RESOLUTION}" \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
--file-idle-time 0 \
--max-files 0 \
--background-colour "${BKG}" \
--font-size "${FONT_SIZE}" \
--title "${TITLE}" \
--output-ppm-stream - \
--output-framerate "${FRAMERATE}"
}
# Run avconv to convert output to mp4
function avconv_mp4 () {
avconv \
-y \
-r 30 \
-f image2pipe \
-vcodec ppm \
-i - \
-b 65536K "${FILENAME}".mp4
}
# Run gource and convert the output
gource_output | avconv_mp4
# Open the movie to preview it
open "${FILENAME}".mp4
# Open the dir to copy the file
# open .
# Go back to home
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment