add offset script

This commit is contained in:
dexterlb 2023-11-10 11:32:28 +02:00
parent 1d0d808be1
commit 30d256f297
1 changed files with 30 additions and 0 deletions

30
2023/video/offset.sh Executable file
View File

@ -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} <input> <output> <offset>"
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}"