youtube-dl: Ripping High-Quality Audio

[linkstandalone]

Just another quick youtube-dl tutorial, this time on how to rip the audio from videos. Again, just add this to your .bashrc file

As .opus (directly from YouTube)

function ytaudiorip() {
	youtube-dl -f bestaudio -o tmpaudio.webm -- $1
	ffmpeg -i tmpaudio.webm -c:a copy ${2}.opus
	rm tmpaudio.webm
}

As .ogg (conversion with ffmpeg)

function ytaudiorip-ogg() {
	youtube-dl -f bestaudio -o tmpaudio.webm -- $1
	ffmpeg -i tmpaudio.webm -b:a 160k ${2}.ogg
	rm tmpaudio.webm
}