Getme video

Simple recipe to get youtube video in avi or ogg format from your terminal.

Ingredients:
youtube-dl, ffmpeg, ffmpeg2theora
sudo apt-get install  youtube-dl ffmpeg ffmpeg2theora

cat >> ~/.bashrc << "EOF"
getme(){
if [[ $1 == avi && $2 != "" ]]; then
url=$2
filename=$(echo $url | cut -d"=" -f2)
youtube-dl $url 
ffmpeg -i $filename.flv $filename.avi
else
if [[ $1 == ogg && $2 != "" ]]; then
url=$2
filename=$(echo $url | cut -d"=" -f2)
youtube-dl $url
ffmpeg2theora -v 10 -S 0 -a 10 --sync $filename
else
echo "Use getme <ogg/avi> <link>"
fi
fi 
}
EOF

Addon:
To get mp3 out of the video, just add the below line in each method
ffmpeg -i $filename -vn -acodec copy $filename.mp3

Steps:
1. Copy paste the code in the terminal.
2. exec bash
3. getme [ogg/avi] [youtube_link]
4. Share better ideas in the comment area!

Share this