Converting any video to a podcast

If you don't always have time to sit down in front of your computer to watch long video presentations (lectures, talks, etc.), then you might find this simple script useful. That's what I use to convert any video file to a podcast that I can listen to on the go.

First, dump the audio using mplayer to a file called audiodump.wav:

mplayer -vo null -ao pcm:fast input_video_file  

Then, if you want, you can downsample that wave file (using sox) since voice doesn't need the same quality as music:

sox audiodump.wav --rate 32000 -1 --channels 1 audiodump_small.wav vol 0.9 dither

Finally, encode the file as in the SPEEX format (if your music player supports it):

speexenc --denoise --vbr --dtx audiodump_small.wav output.spx  

You could also use the OGG Vorbis format:

oggenc --downmix --output=output.ogg audiodump.wav

or create an MP3 using lame:

lame -mm audiodump.wav output.mp3

It works very well with Youtube videos, but you have to download the video first using youtube-dl or clive.