3月 25 2009

Mac で wma (asf) から mp3 に変換してそのまま iTunes に登録

Published by HoLY at 4:54:30 under tech

前回の続き。

iTunes の AppleScript を漁って AppleScript 初体験しつつ、こんな感じのシェルスクリプトを書いた。

#!/bin/sh 
bitrate=96k
file=$1

if [ -z $file ]; then
    exit 1
fi 
ffmpeg -i $file -acodec libmp3lame -ab $bitrate $file.mp3;
osascript -e 'tell application "iTunes" to add "'`pwd`/$file.mp3'" as POSIX file to playlist "radio"'

これを enc.sh とかにして sh enc.sh radio.wma みたいに入力すればエンコードした上で登録してくれる。

AppleScript は型(というのか?)についてもう少し理解を含めることが必要だなー。

Tags: ,

No responses yet

Trackback URI | Comments RSS

Leave a Reply