Last active
October 9, 2017 13:20
-
-
Save s-leroux/c92702edc4770c924507a0ff728d5d8d to your computer and use it in GitHub Desktop.
LightWorks on Linux/MacOSX does produce random audio artifacts when rendering a project. This script is a workaround comparing three independent renderings to guess those that do not contain those artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function usage() { | |
| echo Usage: $0 dir1 ...dirN [+GLOB] >&2 | |
| } | |
| function fail() { | |
| echo $1 >&2 | |
| usage | |
| exit 1 | |
| } | |
| function perm() { | |
| for((i=0;i<$1;++i)); do | |
| for((j=$i+1;j<$1;++j)); do | |
| echo $i $j | |
| done | |
| done | |
| } | |
| [ $# -le 2 ] && fail | |
| DIRS=( "$@" ) | |
| GLOB='*' | |
| for((i = 0; i < ${#DIRS[@]}; ++i)); do | |
| d="${DIRS[i]}" | |
| case "$d" in | |
| +*) GLOB="${d:1}" | |
| unset DIRS[i] | |
| ;; | |
| *) [ -d "$d" ] || fail "$d is not a directory" | |
| esac | |
| done | |
| # DIR A is assumed to be the "master" directory | |
| (cd "${DIRS[0]}" ; find . -type f -name "${GLOB}" -print0) | | |
| while IFS= read -r -d $'\0' fpath ; do | |
| OK="" | |
| perm ${#DIRS[@]} | while read A B ; do | |
| if [ -z "$OK" ] | |
| then | |
| FA="${DIRS[$A]}/${fpath}" | |
| FB="${DIRS[$B]}/${fpath}" | |
| echo Comparing $FA and $FB | |
| if diff -q "${FA}" "${FB}" > /dev/null | |
| then | |
| OK=1 | |
| echo "${FA}" | |
| fi | |
| fi | |
| done | |
| [ -z "$OK" ] || echo "No match for $fpath" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function usage() { | |
| echo Usage: $0 video.mp4 audio.wav destination | |
| } | |
| function fail() { | |
| { | |
| echo $0 | |
| usage | |
| } >&2 | |
| exit 1 | |
| } | |
| [ $# -ne 3 ] && fail "Bad argumant count" | |
| EPISODE_ID=$(sed -Ee 's/.*?(EP[[:digit:]]+).*/\1/' <<< "$3") | |
| YEAR=$(date +%Y) | |
| DATE=$(date --rfc-3339=seconds) | |
| case "$1" in | |
| *.wav) AUDIO="$1" | |
| VIDEO="$2" | |
| ;; | |
| *) VIDEO="$1" | |
| AUDIO="$2" | |
| esac | |
| ffmpeg -i "${VIDEO}" -i "${AUDIO}" -flags:v +global_header -vcodec copy \ | |
| -metadata author="${AUTHOR:-Sylvain Leroux}" \ | |
| -metadata copyright="Copyright (c) ${YEAR} ${AUTHOR:-Sylvain Leroux}" \ | |
| -metadata year="${YEAR}" \ | |
| -metadata title="${TITLE:-Yes, I Know IT !}" \ | |
| -metadata genre="${GENRE:-Education}" \ | |
| -metadata show="${SHOW:-Yes, I Know IT !}" \ | |
| -metadata episode_id="${EPISODE_ID:-EP00}" \ | |
| "$3" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment