Created
December 11, 2019 15:20
-
-
Save dericed/46ad833ef726600dca4104352d7ecab3 to your computer and use it in GitHub Desktop.
This file contains 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}")" | |
PASP_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 Description']/mt:block[@name='Video']/mt:block[@name='Pixel Aspect Ratio']/mt:data[@name='hSpacing']" -v @offset)" | |
if [[ "${PASP_OFFSET}" = "" ]] ; then | |
echo "${NAME} has no pixel aspect ratio atom anyway, skipping" | |
else | |
echo "${NAME} has a pixel aspect ratio atom at ${PASP_OFFSET}" | |
sfk setbytes "${FILE}" "${PASP_OFFSET}" 0x000000200000001B -yes | |
fi | |
} | |
while [[ "${@}" != "" ]] ; do | |
INPUT="${1}" | |
shift | |
if [[ -f "${INPUT}" ]] ; then | |
_fix "${INPUT}" | |
else | |
"${1} was not a file, please run '${0} file.mov' " | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment