Created
February 3, 2020 20:57
-
-
Save dericed/9c8901def18ea03c9eaacb33c5a1ee67 to your computer and use it in GitHub Desktop.
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 | |
_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