From 30d256f297146969769a22352ffa90f214fa6efe Mon Sep 17 00:00:00 2001 From: dexterlb Date: Fri, 10 Nov 2023 11:32:28 +0200 Subject: [PATCH] add offset script --- 2023/video/offset.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 2023/video/offset.sh diff --git a/2023/video/offset.sh b/2023/video/offset.sh new file mode 100755 index 0000000..b8fc6ed --- /dev/null +++ b/2023/video/offset.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -euo pipefail + +function msg { + echo "${@}" >&2 +} + +function die { + msg "${@}" + exit 1 +} + +if [[ $# -ne 3 ]]; then + die "usage: ${0} " +fi + +input="${1}" +output="${2}" +offset="${3}" + +if [[ ! -f "${input}" ]]; then + die "input file ${input} does not exist" +fi + +if [[ -e "${output}" ]]; then + die "output file ${output} already exists" +fi + +ffmpeg -i "${input}" -itsoffset "${offset}" -i "${input}" -map 1:v -map 0:a -c copy "${output}"