]> code.delx.au - transcoding/blobdiff - rip-audio
rip-dvd: don't extract iso to directory
[transcoding] / rip-audio
index 1ed4d180695dfe46ba6df051e847bc96a718cf93..556c87ffa6d28bcdc25dc8f218b2646f3956109d 100755 (executable)
--- a/rip-audio
+++ b/rip-audio
@@ -4,18 +4,22 @@ MPLAYER="mplayer"
 FFMPEG="ffmpeg"
 
 if [ -z "$1" ]; then
-       echo "Usage: $0 filename"
-       exit 1
+    echo "Usage: $0 filename"
+    exit 1
 fi
 
 INPUT="$1"
 
-acodec="$("$MPLAYER" -identify -frames 0 "$INPUT" | grep ID_AUDIO_CODEC | cut -d= -f2)"
+acodec="$(
+    "$MPLAYER" -noconfig all -identify -vo null -ao null -frames 0 "$INPUT" |
+    grep ID_AUDIO_CODEC |
+    cut -d= -f2
+)"
 if [ "$acodec" = "ffaac" ]; then
-       ext=".m4a"
+    ext=".m4a"
 else
-       echo "Unknown audio codec! $acodec"
-       exit 1
+    echo "Unknown audio codec! $acodec"
+    exit 1
 fi
 
 OUTPUT="$(basename "$INPUT" | sed 's/\.[a-zA-Z1-9]*$//')${ext}"