This tutorial shows how to bulk download YouTube videos on Linux and then convert the FLV files to MPG video and MP3 audio files.
I am using Ubuntu Linux, but the concept should be the same for other distros. Make sure you already have all of the multimedia codecs including ffmpeg and mplayer. You will also need to install youtube-dl:
sudo apt-get install youtube-dl
To download YouTube videos on Linux, use youtube-dl in the terminal like this:
youtube-dl [options] video_url
To see available options type man youtube-dl in a terminal.
To convert YouTube movies from FLV to MPG on Linux use ffmpeg like this in the terminal:
ffmpeg -i old-file.flv new-file.mpg
It is easy to extract MP3 audio from a YouTube movie on Linux with mplayer.
The method to rip MP3 audio from FLV files with ffmpeg from this site doesn't work on my computer so I use mplayer to do it:
mplayer -dumpaudio old-file.flv -dumpfile new-file.mp3
If you want to download a set of YouTube movies and convert them to MP3 audio, or save them as MPG movies on your hard drive, you can automate the process with a shell script.
This is just a quick script showing how it might be done. Use the following code at your own risk, and make sure you understand what it does before doing it. It will delete all the FLV files in the current directory after it processes them.
See also pytube...