Skip to content

Instantly share code, notes, and snippets.

@dericed
Created February 3, 2020 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dericed/9c8901def18ea03c9eaacb33c5a1ee67 to your computer and use it in GitHub Desktop.
Save dericed/9c8901def18ea03c9eaacb33c5a1ee67 to your computer and use it in GitHub Desktop.
#!/bin/bash
_fix(){
FILE="${1}"
NAME="$(basename "${FILE}")"
SDTP_OFFSET="$(mediaconch -mt "${FILE}" | xmlstarlet sel -N mt="https://mediaarea.net/mediatrace" -t -m "mt:MediaTrace/mt:media/mt:block[@name='File header']/mt:block[@name='Track']/mt:block[@name='Media']/mt:block[@name='Media Information']/mt:block[@name='Sample Table']/mt:block[@name='Sample Dependency']/mt:block[@name='Header']/mt:data[@name='Name']" -v @offset)"
if [[ "${SDTP_OFFSET}" = "" ]] ; then
echo "${NAME} has no sample dependency table anyway, skipping"
else
echo "${NAME} has a sample dependency table at ${SDTP_OFFSET}"
sfk setbytes "${FILE}" "${SDTP_OFFSET}" "skip" -yes
fi
}
while [[ "${@}" != "" ]] ; do
INPUT="${1}"
shift
if [[ -f "${INPUT}" ]] ; then
_fix "${INPUT}"
elif [[ -d "${INPUT}" ]] ; then
find "${INPUT}" -type f -name "*.mov" -path "*ISO*" | while read FILE ; do
_fix "${FILE}"
done
else
"${1} was not a file or directory, please run '${0} file.mov' or '${0} directory/with/letters/ISO/in/it'"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment