]> code.delx.au - transcoding/commitdiff
fix-pal-speedup: default to /var/tmp instead of /tmp (tmpfs)
authorJames Bunton <jamesbunton@delx.net.au>
Mon, 12 May 2014 14:25:41 +0000 (00:25 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Mon, 12 May 2014 14:25:41 +0000 (00:25 +1000)
fix-pal-speedup

index 3ac096e286d9f902971d5c85363304bbe721bc48..5e6f8d4907be935c9fa6ac79994282f604099d60 100755 (executable)
@@ -3,7 +3,7 @@
 # Many DVDs released in Australia are sped up from 24fps to 25fps.
 # This script reverses the procedure, correcting the audio pitch.
 # The video framerate is adjusted without re-encoding. The audio is slowed and
-# normalised then re-encoded as mp3.
+# volume normalised then re-encoded as mp3.
 
 if [ -z "$1" -o -z "$2" ]; then
        echo "Usage: $0 destdir infile [infile ...]"
@@ -18,8 +18,6 @@ shift
 
 for infile in "$@"; do
        outfile="$destdir/$(basename "$infile")"
-       tmpdir="$(tempfile -p 'pal-')"
-       rm "$tmpdir"
 
        if [ -f "$outfile" ]; then
                echo "Not overwriting $outfile"
@@ -27,7 +25,7 @@ for infile in "$@"; do
        fi
 
        set -x
-       mkdir "$tmpdir"
+       tmpdir="$(mktemp -d "${TMPDIR:-/var/tmp}/pal-XXXXXXXX")"
        mplayer -novideo -ao pcm:file="${tmpdir}/audio.wav" -vo null "$infile"
        sox "${tmpdir}/audio.wav" "${tmpdir}/audio-fixed.wav" speed "${SLOWDOWN}" gain -n
        lame --preset standard "${tmpdir}/audio-fixed.wav" "${tmpdir}/audio.mp3"