[ Prev ] [ Index ] [ Next ]

Transcoding

Created Friday 14 December 2007

Ogg/Vorbis

(install vorbis-tools)

oggenc -o Tara.ogg \
    -a 'Lama Surya Das and Steven Halpern' \
    -t 'Tara mantra' \
    -l 'Chants to Awaken the Buddhist Heart' \
    -G 'mantra' \
    -c url='http://www.dzogchen.org/chant/tara.htm' \
    Tara.wav

Flag to Ogg/Vorbis

for f in *.flac; do oggenc -o ${f%.flac}.ogg $f; done

Decode from MPlayer

mplayer Tara.rm -ao pcm:fast:file=Tara.wav -vo null -vc raw

Decode from MPlayer and convert to Ogg/Vorbis

(install vorbis-tools)

Bash:

cut1=5
cut2=6
for f in *.flv; do
	f2="${f%.flv}"
	f3="${f2//_/ }"
	artist="${f3:0:$cut1}"
	title="${f3:$cut2}"
	echo "==> $title from $artist"
	mplayer "$f" -ao pcm:fast:file="$f2.wav" -vo null -vc raw
	oggenc -o "$f3.ogg" 	"$f2.wav" -a "$artist" -t "$title"
	rm -f 	"$f2.wav"
done

zsh:

cut1=5
cut2=7
for f in *.flv; do
	f2="${f%.flv}"
	f3="${f2//_/ }"
	artist="${f3[0,$cut1]}"
	title="${f3[$cut2,-1]}"
	echo "==> $title from $artist"
	mplayer "$f" -ao pcm:fast:file="$f2.wav" -vo null -vc raw
	oggenc -o "$f3.ogg" "$f2.wav" -a "$artist" -t "$title"
	rm -f "$f2.wav"
done

AAC to OGG/Vorbis

zsh:

#! /bin/zsh
cd "$1" || exit 1
shift
cut1=5
cut2=7
for f in *.m4a; do
	info=`mp4info $f`
	title=`grep '^ Name:' <<<"$info" | cut -d' ' -f3-`
	artist=`grep '^ Artist:' <<<"$info" | cut -d' ' -f3-`
	tool=`grep '^ Tool:' <<<"$info" | cut -d' ' -f3-`
	year=`grep '^ Year:' <<<"$info" | cut -d' ' -f3-`
	album=`grep '^ Album:' <<<"$info" | cut -d' ' -f3-`
	track=`grep '^ Track:' <<<"$info" | cut -d' ' -f3-`
	disk=`grep '^ Disk:' <<<"$info" | cut -d' ' -f3-`
	genre=`grep '^ Genre:' <<<"$info" | cut -d' ' -f3-`
	tempo=`grep '^ Tempo:' <<<"$info" | cut -d' ' -f3-`
	compilation=`grep '^ Part of Compilation' <<<"$info" | cut -d' ' -f5-`
	gapless=`grep '^ Part of Gapless Album' <<<"$info" | cut -d' ' -f6-`
	f2="${f%.m4a}"
	f3="${f2//_/ }"
	mplayer "$f" -ao pcm:fast:file="$f2.wav" -vo null -vc raw
	oggenc -o "$f3.ogg" "$f2.wav" -a "$artist" -t "$title" -l "$album" -G "$genre" -c year="$year" -c track="$track" -c disk="$disk" -c tempo="$tempo" -c compilation="$compilation" -c gapless="$gapless" "$@"
	rm -f "$f2.wav"
done
# kate: hl bash;

Ogg/Vorbis: add tags

vorbiscomment -a file.ogg -t ALBUM="album"
vorbiscomment    file.ogg -c file.tags
vorbiscomment -l file.ogg

FLAC

flac --best -o Tara.flac \
    -T title='Tara mantra' \
    -T artist='Lama Surya Das and Steven Halpern' \
    -T genre='mantra' \
    -T album='Chants to Awaken the Buddhist Heart' \
    -T url='http://www.dzogchen.org/chant/tara.htm' \
    Tara.wav

No backlinks to this page.