Created
April 21, 2010 04:01
-
-
Save sit/373401 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/sh | |
# | |
# Convert from a MTS to a mp4 file using HandbrakeCLI | |
# Handbrake available from, for example, http://handbrake.fr/downloads2.php | |
# | |
# Renames files as prefixYYYYMMDD_basename.mp4 in the current directory. | |
# If you have an AVCHD directory, for example, you could run | |
# mts2mp4 /Volumes/SDCARD/PRIVATE/BDMV/STREAM/*.MTS | |
# to convert from your SDCARD into your current directory (on OS X). | |
# | |
prefix=${USER}_ | |
# Exit the entire script on signal. | |
trap 'exit' 1 2 15 | |
# Abort on any conversion error (or if file is missing!) | |
set -e | |
for f in "$@" | |
do | |
# Name the output file based on the file modification time. | |
# (The ctime may have been affected by the time the file was copied, chmod, etc) | |
eval $(stat -s $f) | |
of=$prefix$(date -j -f %s $st_mtime +%Y%m%d)_$(basename $f .MTS).mp4 | |
time nice HandbrakeCLI --preset="Normal" -i $f -o $of | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment