Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2012 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3834590 to your computer and use it in GitHub Desktop.
Save anonymous/3834590 to your computer and use it in GitHub Desktop.
mora file to iOS-compatible m4a converter
#!/usr/bin/env bash
# Reference:
# http://thousandleaves-project.com/blog/2012/10/drmフリーになったmora楽曲を再エンコードなしでiphonetouchで.html
mp4box=/Applications/Osmo4.app/Contents/MacOS/MP4Box
if [ $# -eq 0 ]; then
echo "usage: mora2ios.sh file1 [file2 ...]"
exit
fi
TEMPDIR=$(mktemp -d -t mora) || exit 1
for FILE in "$@"; do
if "$mp4box" -quiet -noprog -info "$FILE" | grep -q -i error; then
echo "error occured when converting $FILE" > /dev/stderr
else
"$mp4box" -quiet -noprog -set-meta NULL:tk=0 -out "$TEMPDIR/temp.m4a" "$FILE" > /dev/null
mv "$FILE" "$FILE".orig
mv "$TEMPDIR/temp.m4a" "${FILE%.*}.m4a"
fi
done
rm -r "$TEMPDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment