Created
August 14, 2013 10:28
-
-
Save breunigs/6229823 to your computer and use it in GitHub Desktop.
joins avi files properly so that they may be skipped
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 | |
echo "The following files will be joined:" | |
find -maxdepth 1 -iname "*.AVI" -type f | sort | |
echo "" | |
echo "Output Filename:" | |
echo "(may also be an absolute path; omit" | |
echo "quotation marks unless you want them" | |
echo "to appear in the path/filename)" | |
read -e -p "" | |
echo "" | |
if [ -f "$REPLY" ] | |
then | |
rm -i "$REPLY" | |
echo "" | |
fi | |
if [ -f "$REPLY" ] | |
then | |
echo "Exiting" | |
exit 1 | |
fi | |
TMP=`mktemp` | |
echo "Joining files into temporary file..." | |
find -maxdepth 1 -iname "*.AVI" -type f -print0 | sort -z | xargs -0 cat > $TMP | |
echo "Rebuilding index and saving to destination..." | |
mencoder -forceidx -oac copy -ovc copy $TMP -o "$REPLY" > /dev/null | |
echo "Deleting temporary file..." | |
rm -f $TMP | |
echo "" | |
echo "Done." | |
echo "Joined copy is located at: " | |
echo $REPLY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment