TeachToPod is a bash script (which I've placed in
the public domain) for
ripping lectures from DVDs sold by The
Teaching
Company. (Disclaimer:
I have no affiliation whatever with The Teaching Company, nor is TeachToPod endorsed or supported by
The Teaching Company.) The lectures can be ripped either to audio
(mp3)
files or to video files, or to both, and metadata such
as lecture names is automatically added to the files. Since the
portable media players I happen to have are iPod Classics, the videos
are made to be compatible with the iPod
Classic—namely, they are 320×240 m4v files. I believe that
this format will work with any iPod, iPhone, or iPad, but not having
the devices themselves I have no way to test on anything other than for
the iPod
Classic. The script also provides an option for creating
640×480 m4v as well, which I believe might be the preferred
format for iPad ... though again, I have no way to test.
I've long wished that The Teaching Company would provide such audios
and/or videos as
free downloads to people who buy the DVDs, but sadly they don't.
While it's not hard to rip the audio or video from the DVDs yourself,
it's
irksome to deal with the fact that they will appear in the iPod
without any metadata like lecture names ... unless you go to a lot of
work to manually add that data. With TeachToPod it's no problem at all,
since the metadata is scraped from The Teaching Company's website, so
it all happens automatically and you don't have to type anything
in. All you need to know is the
course number assigned by The Teaching Company.
Look at one of the DVDs to determine the course-number
(#1810).
Create an empty directory hold the data you're
going to be working with, and 'cd' to that directory.
Type in the command "TeachToPod.sh 1810" at the command line.
Feed in a new DVD whenever prompted. You're given both a
video prompt
and an audible prompt when you need to do that. There's no need to type
anything at the keyboard or use the mouse ... just close the DVD tray.
After the entire process has completed, you might (optionally)
want to manually delete the ISO images that have been created from the
DVDs.
To rip just 320×240 video files, "TeachToPod.sh 1600" or
else "TeachToPod.sh 1600 video".
To rip just audio (mp3) files, "TeachToPod.sh 1600
audio".
To rip both audio and 320×240 video files, "TeachToPod.sh
1600 both".
To rip 640×480 video, "TeachToPod.sh 1600 video ipad".
To rip both audio and 640×480 video, "TeachToPod.sh 1600
both
ipad".
Requirements
I've only run the scripts on Ubuntu Linux 10.10.
Probably they can be made to work on any modern Linux, and possibly
even on Mac OS X, but I've not tried it. If you want to run the
scripts directly on Windows,
you're out of luck.
It will work best if Linux is set up to automatically mount a DVD
as a filesystem when you insert it. Most modern Linux
installations will do that anyway. If not, I'm afraid you'll have
to
manually mount the DVD every time you insert one of them.
You need to install HandBrake,
AtomicParsley, id3v2, lame, and SoX.
These programs may have other dependencies I don't know about. In
Ubuntu 10.10, I think that everything other than HandBrake is in the
package repository. Instructions for dealing with HandBrake through the Ubuntu
package/update system are quite easy, though, and can be found here.
Detailed Usage
There are actually 4 scripts in the package, namely the top-level
script TeachToPod.sh and the auxiliary scripts TTP-scrape.sh,
TTP-rip.sh, and TTP-meta.sh. The latter are quite easy to use
individually, but they are typically run automatically by TeachToPod.sh
so I won't bother to describe them in detail. They each have
usage instructions within them if you're interested. They are
used, respectively, to scrape The Teaching Company website's info for a
given course-number, to recode the video and/or audio, and to add
metadata to the
video or audio files. If you want a different video format than
the ones I'm
using, TTP-rip.sh is the script to modify. (If you want to
determine good settings to use for other players, one place to start is
by running HandBrake in GUI
mode and checking the presets it has available.)
As far as TeachToPod.sh is concerned, the usage is as follows:
The CourseNumber is, of
course, the course number assigned to the course by The Teaching
Company. The remaining parameters are all optional, and must be
used in the order shown. If you want to omit a parameter (say, to
specify DVDdevice but to use
the default value for VideoFormat),
include
the missing parameter (VideoFormat
in this example) as "".
AudioVideo
is one of the following:
Blank or "video" to produce video files only.
"audio" to produce audio (mp3) files only.
"both" to produce both audio and video files.
"none" to produce just ISO files that are images of the DVDs, and
won't rip either audio or video from them. (If you keep reading,
you'll see the significance of doing this.)
The VideoFormat option (which
is new as of 20101115) is one of the following:
Blank or "classic" to produce 320×240 m4v.
"ipad" to produce 640×480 m4v.
DVDdevice is
the device used for mounting the DVD, and defaults to /dev/sr0; i.e.,
the
scripts detect DVD insertion by looking to see what's mounted on DVDdevice.
Command is the
command used to play the audible prompt whenever a new DVD is
wanted. It defaults to "play -q TTP-bell.wav", where TTP-bell.wav
is a sound supplied in the TeachToPod.sh download package and "play" is
the playback command from SoX.
If
Command is present, it
will generally contain spaces, so make sure you surround it in
quotation marks.
Of course, if you have the
video files, then you can use them as if
they were audio files by simply not looking at the screen of the iPod
when you play them. However, that's pretty wasteful of battery
power and of flash memory (or hard disk in the case of an iPod
Classic). As a rule of thumb, though there's a lot of variation
from course to course, for 30 minute lectures you find typical file
sizes as follows:
An mp3 file will be around 30 MB.
A 320×240 m4v file will be around 115 MB.
A 640×480 m4v file will be around 460 MB.
When you run the script, what will happen first is that The Teaching
Company website is scraped
for the info about the course. This information is put into a
file called titles.txt, which is a good place to trouble-shoot if you
get funky results for some course or the other.
Then, all of the DVDs will have their contents pulled in and put into
ISO images named 1.iso, 2.iso, etc. (Or, if the DVD set contains
more than 9 DVDs, 01.iso, 02.iso, etc.) After every DVD has been
pulled into an ISO file, it will be automatically ejected and there
will be repeated
visual and audio prompts until the next DVD is inserted and the tray is
closed. That's all you have to do; you don't have to type
anything at the keyboard or use the mouse. So make sure you have
enough space for all those ISO files! That's a lot of space; most
courses seem to be about 6 DVDs, so about 50 GB is needed just for the
ISO files. The reason the ISO files are stored on disk rather
than transcoding
directly from the DVDs is that it minimizes the time that you
personally have to be available for inserting DVDs: If creating
an
ISO file takes (say) 15 minutes but transcoding takes (say) 45
additional minutes, then by making the ISO files from a 6-DVD set
first, you only have
to be available for the 1.5 hours and the computer can crank away by
itself for the final 4.5 hours, whereas if transcoding occurred
directly from DVD you
would have to be available for the entire 6 hours. This makes it
a lot more convenient, for example, to read in all of the DVDs during
evening, and to let the transcoding process run unattended overnight.
Anyway, after all of the DVDs have been converted to ISO files, the
audible prompt will sound a few more times to let you know you can put
the DVDs back on the shelf.
Then, all of the audios or videos of the lectures will be pulled from
the ISO
files and transcoded for the iPod. There will be more tracks on
the DVD than there are lectures, but only the lectures will be
transcoded, and the other tracks will be discarded. After all the
transcoding is done, metadata is added
to each of the lectures.
Once again at the end, the audio prompt will sound a few more times to
let you know that the computer is free. Perhaps to start ripping
the next course!
An important thing to understand about the operation of the script is
that it will only try to create ISO, m4v, or mp3 files that are not
already present. So if you had errors in some of the files, you
could simply delete those files and rerun the scripts, knowing that
only the missing files would
be regenerated ... which is obviously a
lot quicker process than doing all the work from scratch. For
this reason, the script does not automatically delete the ISO files
after they are
used. But if you're sure all the
files are okay and that
the script won't have to be rerun, you can delete the ISOs.
Download
Here's the current tarball containing the scripts, along with all prior
snapshots:
To install, simply open up this tarball and copy all of the files in it
to
someplace in your PATH. In Ubuntu, I think that you can use the
~/bin directory (i.e., the bin/ directory in your home
directory). In other Linux distributions, I'll leave the
appropriate place in the PATH as an
exercise for the reader.
Credit
The logo is a representation of the painting "Star Gazer" by artist Lynn Rothan.