Skip to content

Instantly share code, notes, and snippets.

@jamesbrink
Created May 22, 2020 03:31
Show Gist options
  • Save jamesbrink/6c07ca0f406387dd5dc05ef93fafe265 to your computer and use it in GitHub Desktop.
Save jamesbrink/6c07ca0f406387dd5dc05ef93fafe265 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Start all needed gource instances and connect them
# to a named pipe.
repo="misc"
mkfifo ./tmp/${repo}.pipe
title=$repo
# Set out video title.
title="ACME Software Development."
echo "Starting Gource for ${repo}, using title: ${title}"
# 2d2d2d
gource --seconds-per-day 1 \
--user-scale 1.5 \
--time-scale 1.5 \
--auto-skip-seconds 0.5 \
--title "${title}" \
--background-colour 000000 \
--font-colour 7cc68d \
--camera-mode overview \
--hide usernames,filenames,mouse,date \
--font-size 48 \
--caption-size 24 \
-3820x1940 \
--stop-at-end \
--dir-name-depth 3 \
--filename-time 2 \
--max-user-speed 500 \
--bloom-multiplier 1.2 \
--start-date "2016-08-05 00:00:00 -7" \
--stop-date "2019-03-28 00:00:00 -7" \
./logs/combined.txt \
-r 60 \
-o - | ffmpeg -y -r 60 -f image2pipe -probesize 10M -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 0 -threads 0 -bf 0 ./tmp/${repo}.mp4 &
# Start Gource for the overlay elements.
echo "Starting Gource for overlay components"
mkfifo ./tmp/overlay.pipe
gource --seconds-per-day 1 \
--user-scale 1.5 \
--time-scale 1.5 \
--auto-skip-seconds 0.5 \
--key \
--transparent \
--background-colour 171717 \
--font-colour 7b50a1 \
--camera-mode overview \
--hide bloom,dirnames,files,filenames,mouse,root,tree,users,usernames \
--font-size 60 \
--caption-size 24 \
--1920x1080 \
--stop-at-end \
--dir-name-depth 3 \
--filename-time 2 \
--max-user-speed 500 \
--start-date "2016-08-05 00:00:00 -7" \
--stop-date "2019-03-28 00:00:00 -7" \
./logs/combined.txt \
-r 60 \
-o - | ffmpeg -y -r 60 -f image2pipe -probesize 10M -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 0 -threads 0 -bf 0 ./tmp/overlay.mp4 &
wait
# Start ffmpeg and read from the named pipes.
# 20px border
# 320x2160px key
# 200x3840px date
# input video: -3560x1940
# video size with border: -3520xx1960
mkdir -p ./video
ffmpeg -y -i ./tmp/misc.mp4 \
-y -i ./tmp/overlay.mp4 \
-i ./logo.png \
-filter_complex "[0:v]pad=3840:1960:3840:1960:#2d2d2d[center];\
[1:v]scale=3840:2160[date_scale];\
[date_scale]crop=3520:200:640:0,pad=3840:200:320:200:#171717[date];\
[date][center]vstack[with_date];\
[with_date][2:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10[with_logo]" \
-map "[with_logo]" \
-vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 ./tmp/combined_4k.lossless.mp4
ffmpeg -i ./tmp/combined_4k.lossless.mp4 -vcodec libx264 -level 5.1 -preset veryslow -pix_fmt yuv420p -crf 23 -threads 8 -bf 0 ./video/combined_4k.mp4
#!/bin/bash
# Start all needed gource instances and connect them
# to a named pipe.
for repo in ios android web misc; do
mkfifo ./tmp/${repo}.pipe
title=$repo
camera="overview"
# Set out video titles.
case "${repo}" in
"ios")
title="iOS Mobile Development"
;;
"android")
title="Android Mobile Development"
;;
"web")
title="Web and API Development"
;;
"misc")
title="All other Misc. Development"
camera="overview"
;;
esac
echo "Starting Gource for ${repo}, using title: ${title}"
gource --seconds-per-day 5 \
--padding 1.8 \
--time-scale 4.0 \
--user-scale 1.0 \
--auto-skip-seconds 0.5 \
--background-colour 000000 \
--font-colour 7cc68d \
--camera-mode ${camera} \
--hide dirnames,users,filenames,usernames,mouse,date \
--font-size 48 \
--caption-size 24 \
-1280x800 \
--stop-at-end \
--filename-time 2 \
--max-user-speed 250 \
--start-date "2016-08-05 00:00:00 -7" \
--stop-date "2018-10-28 00:00:00 -7" \
--file-filter "\/ACME\.xc*" \
./logs/${repo}_combined.txt \
-r 60 \
-o - | ffmpeg -y -r 60 -f image2pipe -probesize 10M -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 0 -threads 0 -bf 0 ./tmp/${repo}.mp4 &
done
# Start Gource for the overlay elements.
# echo "Starting Gource for overlay components"
# mkfifo ./tmp/overlay.pipe
# gource --seconds-per-day 0.1 \
# --user-scale 1.0 \
# --key \
# --transparent \
# --background-colour 171717 \
# --font-colour 7b50a1 \
# --camera-mode overview \
# --hide bloom,dirnames,files,filenames,mouse,root,tree,users,usernames \
# --font-size 60 \
# --caption-size 24 \
# --1920x1080 \
# --stop-at-end \
# --dir-name-depth 3 \
# --filename-time 2 \
# --max-user-speed 500 \
# --start-date "2016-08-05 00:00:00 -7" \
# --stop-date "2016-08-06 00:00:00 -7" \
# --file-filter "\/ACME\.xc*" \
# ./logs/combined.txt \
# -r 60 \
# -o - | ffmpeg -y -r 60 -f image2pipe -probesize 10M -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 0 -threads 0 -bf 0 ./tmp/overlay.mp4 &
wait
# Start ffmpeg and read from the named pipes.
# 20px border
# 320x2160px key
# 200x3840px date
# input video: 1740x960
# video size with border: 1760x980
mkdir -p ./video
ffmpeg -y -i ./tmp/ios.mp4 \
-y -i ./tmp/android.mp4 \
-y -i ./tmp/web.mp4 \
-y -i ./tmp/misc.mp4 \
-i ./logo.png \
-filter_complex "[0:v][1:v]hstack[top];\
[2:v][3:v]hstack[bottom];\
[top][bottom]vstack[quad];\
[quad][4:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10[quad_with_logo]" \
-map "[quad_with_logo]" \
-vcodec libx264 -level 5.1 -tune animation -preset ultrafast -pix_fmt yuv420p -crf 0 -threads 8 -bf 0 ./video/quad_blend_4k.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment