]>
code.delx.au - transcoding/blob - fix-pal-speedup
3 # Many DVDs released in Australia are sped up from 23.976fps to 25fps.
4 # This script reverses the procedure, correcting the audio pitch.
5 # Input files are assumed to be mkv files with track 2 audio.
6 # The video framerate is adjusted without re-encoding. The audio is slowed and
7 # normalised then re-encoded as mp3.
9 if [ -z "$1" -o -z "$2" ]; then
10 echo "Usage: $0 destdir infile"
14 # FORCEFPS = 24000 / 1001
15 # SLOWDOWN = FORCEFPS / 25
16 FORCEFPS
="23.976023976023978"
17 SLOWDOWN
="0.9590409590409591"
21 outfile
="$destdir/$(basename "$infile")"
22 tmpdir
="$(tempfile -p 'pal-')"
25 if [ -f "$outfile" ]; then
26 echo "Not overwriting $outfile"
32 mkvextract tracks
"$infile" 2:"${tmpdir}/audio"
33 mplayer
-ao pcm
:file="${tmpdir}/audio.wav" -vo null
"${tmpdir}/audio"
34 sox
"${tmpdir}/audio.wav" "${tmpdir}/audio-fixed.wav" speed "${SLOWDOWN}" gain
-n
35 lame
--preset standard
"${tmpdir}/audio-fixed.wav" "${tmpdir}/audio.mp3"
36 mkvmerge
-o "${outfile}" --default-duration "1:${FORCEFPS}fps" --no-audio "$infile" "${tmpdir}/audio.mp3"