Tuesday, February 17, 2009

Convert Youtube Videos to mp3

1. Use youtube-dl to download the flv file. Add -b -o '%(stitle)s.%(ext)s' parameters to get maximum quality and proper naming.

To download a list of videos, use youtube-dl -a list.txt

2. Use ffmpeg to convert the file to an mp3 file.
ffmpeg -i 0-_h1gaZA48.flv -ac 2 -ar 44100 -ab 192k 0.mp3

To convert all at once,

for nam in *.mp4; do ffmpeg -i "$nam" -ac 2 -ar 44100 -ab 192k `basename $nam .mp4`.mp3; done


3. Finally tag the mp3's using id3v2.
for name in *.mp3; do id3v2 $name -t `basename $name .mp3`; done

No comments: