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}"