Skip to content

Instantly share code, notes, and snippets.

@Sotilrac
Forked from derEremit/gource-multiple-repositories.sh
Last active November 4, 2022 19:05
Show Gist options
  • Select an option

  • Save Sotilrac/6b998e7e01753ce67b8b44212a6fdc44 to your computer and use it in GitHub Desktop.

Select an option

Save Sotilrac/6b998e7e01753ce67b8b44212a6fdc44 to your computer and use it in GitHub Desktop.

Revisions

  1. Sotilrac revised this gist Dec 23, 2020. 2 changed files with 102 additions and 42 deletions.
    102 changes: 102 additions & 0 deletions gource-multi-repo.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    #!/usr/bin/env bash
    # Generates gource video (h.264) out of multiple repositories.
    # Pass the repositories in command line arguments.
    # Example:
    # <this.sh> /path/to/repo1 /path/to/repo2
    # Or use ls -d * to list all folders in a location
    # <this.sh> `ls -d *`

    RESOLUTION="1920x1080" # HD
    # RESOLUTION="2560x1440" # QHD
    # RESOLUTION="4096x2160" # 4K
    TITLE="Software Development"
    # Title to snake_case with date and file extension
    OUTPUT=`sed -e 's/\(.*\)/\L\1/' <<< "$TITLE"| sed -r 's/[ ]+/_/g'`_`date +%F_%H-%M
    `.mp4
    BG_COLOUR="38383D"
    FPS="60"

    install_deps() {
    # List of dependencies
    deps=(gource ffmpeg)
    pkgs=""
    # Check which pkgs are not installed and make a list
    for pkg in ${deps[*]}
    do
    PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $pkg|grep "install ok installed")
    echo Checking for $pkg: $PKG_OK
    if [ "" = "$PKG_OK" ]; then
    echo "No $pkg."
    pkgs="$pkgs $pkg"
    fi
    done
    # Install missing packages
    if [ -n "$pkgs" ]; then
    sudo apt install $pkgs
    fi
    }

    make_video() {
    i=0
    tmp_log=/tmp/gource.XXXXXX
    for repo in $*; do
    # 1. Generate a Gource custom log files for each repo.
    # This can be facilitated by the --output-custom-log FILE
    logfile="$(mktemp $tmp_log)"
    gource --output-custom-log "${logfile}" ${repo}
    # 2. If you want each repo to appear on a separate branch instead of merged
    # onto each other (which might also look interesting), you can use a 'sed'
    # regular expression to add an extra parent directory to the path of the
    # files in each project:
    sed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
    logs[$i]=$logfile
    let i=$i+1
    done

    combined_log="$(mktemp $tmp_log)"
    cat ${logs[@]} | sort -n > $combined_log
    rm ${logs[@]}

    echo ""
    echo "Committers:"
    cat $combined_log | awk -F\| {'print $2'} | sort | uniq
    echo "======================"

    time gource $combined_log \
    -s 0.55 \
    -i 0 \
    -$RESOLUTION \
    --screen 2 \
    --highlight-users \
    --highlight-dirs \
    --file-extensions \
    --hide mouse,filenames \
    --background-colour $BG_COLOUR \
    --auto-skip-seconds .1 \
    --key \
    --stop-at-end \
    --camera-mode overview \
    --title "$TITLE" \
    --user-image-dir users \
    --output-framerate $FPS \
    --frameless \
    --output-ppm-stream - \
    | ffmpeg -y \
    -r $FPS \
    -f image2pipe \
    -vcodec ppm \
    -i - \
    -vcodec libx264 \
    -preset fast \
    -crf 18 \
    -threads 0 \
    -bf 0 \
    -pix_fmt yuv420p \
    -movflags \
    +faststart \
    $OUTPUT
    rm $combined_log
    }

    install_deps &
    make_video $*
    42 changes: 0 additions & 42 deletions gource-multiple-repositories.sh
    Original file line number Diff line number Diff line change
    @@ -1,42 +0,0 @@
    #!/usr/bin/env bash
    # Generates gource video (h.264) out of multiple repositories.
    # Pass the repositories in command line arguments.
    # Example:
    # <this.sh> /path/to/repo1 /path/to/repo2

    RESOLUTION="1920x1080"
    outfile="gource.mp4"

    i=0
    for repo in $*; do
    # 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
    logfile="$(mktemp /tmp/gource.XXXXXX)"
    gource --output-custom-log "${logfile}" ${repo}
    # 2. If you want each repo to appear on a separate branch instead of merged onto each other (which might also look interesting), you can use a 'sed' regular expression to add an extra parent directory to the path of the files in each project:
    sed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
    logs[$i]=$logfile
    let i=$i+1
    done

    combined_log="$(mktemp /tmp/gource.XXXXXX)"
    cat ${logs[@]} | sort -n > $combined_log
    rm ${logs[@]}

    echo "Committers:"
    cat $combined_log | awk -F\| {'print $2'} | sort | uniq
    echo "======================"

    time gource $combined_log \
    -s 0.4 \
    -i 0 \
    -$RESOLUTION \
    --highlight-users \
    --highlight-dirs \
    --file-extensions \
    --hide mouse,filenames \
    --background-colour FFFFFF \
    --auto-skip-seconds .1 \
    --key \
    --stop-at-end \
    --output-ppm-stream - | avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K $outfile
    rm $combined_log
  2. Sotilrac revised this gist Jul 19, 2016. No changes.
  3. Sotilrac revised this gist Jul 19, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions gource-multiple-repositories.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # Example:
    # <this.sh> /path/to/repo1 /path/to/repo2

    RESOLUTION="1600x1080"
    RESOLUTION="1920x1080"
    outfile="gource.mp4"

    i=0
    @@ -34,7 +34,9 @@ time gource $combined_log \
    --highlight-dirs \
    --file-extensions \
    --hide mouse,filenames \
    --background-colour FFFFFF \
    --auto-skip-seconds .1 \
    --key \
    --stop-at-end \
    --output-ppm-stream - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -threads 0 -r 24000/1001 -b 6144k -bt 8192k -vcodec libx264 -pass 1 -flags +loop -me_method dia -g 250 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -b_strategy 1 -i_qfactor 0.71 -cmp +chroma -subq 1 -me_range 16 -coder 1 -sc_threshold 40 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -keyint_min 25 -refs 1 -trellis 0 -directpred 1 -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -an $outfile
    --output-ppm-stream - | avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K $outfile
    rm $combined_log
  4. @derEremit derEremit revised this gist Nov 8, 2011. 1 changed file with 0 additions and 0 deletions.
    Empty file modified gource-multiple-repositories.sh
    100755 → 100644
    Empty file.
  5. Sebastian Paul revised this gist Nov 8, 2011. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions gource-multiple-repositories.sh
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,16 @@
    # Example:
    # <this.sh> /path/to/repo1 /path/to/repo2

    RESOLUTION="1600x1080"
    outfile="gource.mp4"

    i=0
    for repo in $*; do
    # 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
    logfile="$(mktemp /tmp/gource.XXXXXX)"
    gource --output-custom-log "${logfile}" ${repo}
    # 2. If you want each repo to appear on a separate branch instead of merged onto each other (which might also look interesting), you can use a 'sed' regular expression to add an extra parent directory to the path of the files in each project:
    gsed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
    sed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
    logs[$i]=$logfile
    let i=$i+1
    done
    @@ -23,15 +26,15 @@ echo "Committers:"
    cat $combined_log | awk -F\| {'print $2'} | sort | uniq
    echo "======================"

    outfile="gource.mp4"
    time gource $combined_log \
    -s 0.4 \
    -i 0 \
    -$RESOLUTION \
    --highlight-users \
    --highlight-dirs \
    --file-extensions \
    --hide mouse \
    --hide mouse,filenames \
    --key \
    --stop-at-end \
    --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre default $outfile
    --output-ppm-stream - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -threads 0 -r 24000/1001 -b 6144k -bt 8192k -vcodec libx264 -pass 1 -flags +loop -me_method dia -g 250 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -b_strategy 1 -i_qfactor 0.71 -cmp +chroma -subq 1 -me_range 16 -coder 1 -sc_threshold 40 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -keyint_min 25 -refs 1 -trellis 0 -directpred 1 -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -an $outfile
    rm $combined_log
  6. @invalid-email-address Anonymous created this gist Mar 24, 2011.
    37 changes: 37 additions & 0 deletions gource-multiple-repositories.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    #!/usr/bin/env bash
    # Generates gource video (h.264) out of multiple repositories.
    # Pass the repositories in command line arguments.
    # Example:
    # <this.sh> /path/to/repo1 /path/to/repo2

    i=0
    for repo in $*; do
    # 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
    logfile="$(mktemp /tmp/gource.XXXXXX)"
    gource --output-custom-log "${logfile}" ${repo}
    # 2. If you want each repo to appear on a separate branch instead of merged onto each other (which might also look interesting), you can use a 'sed' regular expression to add an extra parent directory to the path of the files in each project:
    gsed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
    logs[$i]=$logfile
    let i=$i+1
    done

    combined_log="$(mktemp /tmp/gource.XXXXXX)"
    cat ${logs[@]} | sort -n > $combined_log
    rm ${logs[@]}

    echo "Committers:"
    cat $combined_log | awk -F\| {'print $2'} | sort | uniq
    echo "======================"

    outfile="gource.mp4"
    time gource $combined_log \
    -s 0.4 \
    -i 0 \
    --highlight-users \
    --highlight-dirs \
    --file-extensions \
    --hide mouse \
    --key \
    --stop-at-end \
    --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre default $outfile
    rm $combined_log