Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cronjob script for finding mp4 files in a directory then exporting and stripping chapters for compatibility with Adobe Media Server
#!/bin/bash
lockdir=~/
searchdir=$1
if [ -e ${lockdir}/.stripChaptersCronJob.lock ]
then
exit
fi
touch ${lockdir}/.stripChaptersCronJob.lock
touch ${searchdir}/.stripChaptersCronJob.timestamp.2
if [ -e ${searchdir}/.stripChaptersCronJob.timestamp ]
then
filelist=`find ${searchdir} -type f -newer ${searchdir}/.stripChaptersCronJob.timestamp -name '*.mp4'`
else
filelist=`find ${searchdir} -type f -name '*.mp4'`
fi
mv ${searchdir}/.stripChaptersCronJob.timestamp.2 ${searchdir}/.stripChaptersCronJob.timestamp
for file in $filelist
do
if [ `mp4chaps -l $file 2> /dev/null | wc -l` -gt 1 ]
then
mp4chaps -q -x -C $file
mp4chaps -q -r $file
fi
done
rm ${lockdir}/.stripChaptersCronJob.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.