Encoding Audio to Video
Borrowed from YouTube.com. I’m encoding audio to video?

So, for about two years now, I’ve been recording my lectures using a standard audio recorder. It does a wonderful job. It records to .WMA and through the use of the script found in this blog post the conversion happens easily.

I’ve also always been a fan of YouTube in education. Big fan. Big. Huge!  (Movie quote, anyone?)  In fact, here’s my channel: https://www.youtube.com/user/jernstberger

YouTube now is ranked second  for search engine uses in the world. Of course, one would gain prolific exposure by putting their work online on YouTube.  Plus, YT does such a good job of making video (and audio) available to a variety of people, with a variety of devices, at a variety of bandwidths and resolutions.

Encoding Audio to Video

I’ve been encrypting so much video lately that I thought to myself, “why not offer to just put these lectures on YT?” The video assembly part is easy. Originally, I dropped the audio into Kdenlive and began the editing. It took forever. Why? So, I remembered the ffmpeg/avconv (Ubuntu) framework. Here’s what I’ve learned.

  1. From this stackoverflow article, I learned that you CAN–in fact–take a single image and lay it out over an audio track.
  2. From this maketecheasier.com article, I was reminded that the conversion to .webm is really nice and plays so well with the open-sourciness of Linux.
  3. Finally, from libav, I learned about avconv, a very nice port of ffmpeg,–also what is available on my Ubuntu install– and commands.

I cobbled together the command

avconv -i $1 -i $2 -acodec libvorbis -ab 64k -ar 44100 -b 200k -s hd720 $3.webm

in a Bash script that takes three inputs: an image file, the audio file, and the name of the output file (sans extension). Four hours ago, at this point, I chuckled to myself and said “this was so easy!”. Self, you speak too soon.

I uploaded the video to YouTube. Upload went smoothly, but the processing took phenomenally long. Finally YT said that the video could not be processed. I tried the whole process again. Same results. Now, I’ve dropped a new piece of code into the script:

avconv -i $3.webm $3.mp4

Hopefully, this will make a swell conversion to .mp4 (using libx264) and YT will be happy. I know that I would be.


As a few notes, I’m using these commands from the Linux command line.  These tools are probably freely available, also, for Mac users.  As a note, command line tools are much more efficient in processing time than graphically-interfaced programs. However, configuring the commands, on the front end, are much more time consuming.  Regardless, I enjoy their usage.

Hopefully, this article (and some of the ones from the past) will be of help to some people in the process of encoding audio to video.

Feel free to leave any comments or questions below!  I’d love to help.

Encoding Audio to Video
Tagged on: