Video: Encoding audio formats with VLC

To create our audio files, we are going to use a program called VLC. VLC is a free media player that can play just about any type of file and we can also use it for encoding our audio files. First you will need to download and install VLC, which you can find at http://www.videolan.org/vlc. All right, when we open VLC we are presented with the media player and the first thing we need to do is open the file that we want to encode. So I am going to open our audio source which is in our _audio assets folder and it's our podcast-audio.mov.

In this course, author Steve Heffernan contextualizes the state of HTML5 audio and video and shows how to embed media into a web page using HTML5. The course sheds light on configuring the new HTML5 audio and video tags, ensuring backwards compatibility by setting alternative playback methods, encoding the needed file formats, and building custom controls with JavaScript. Also included are tutorials on troubleshooting known issues and reviewing real-world examples of HTML5 audio and video.

Encoding audio formats with VLC

To create our audio files, we are going to use a program called VLC.VLC is a free media player that can play just about any type of file and we canalso use it for encoding our audio files.First you will need to download and install VLC, which you can find athttp://www.videolan.org/vlc.All right, when we open VLC we are presented with the media player and the firstthing we need to do is open the file that we want to encode.So I am going to open our audio source which is in our _audio assets folder andit's our podcast-audio.mov.

(Music playing)And you can see it starts playing that as if we wantto listen to it, but we don't right now.What we want to do is to go under the File menu and select theStreaming/Exporting Wizard.We will open that up and now we are basically taking through a step by stepprocess to create the files that we want.The first step is to select Transcode/ Save to file and click Next and thenselect in our Existing playlist, we find our podcast-audio movie.So we will choose the first one in the list and then check the audio checkboxfor Transcode audio and the first source we are going to do is actually the MP3source, so we will go ahead and leave it set to MP3 and 192 is actually a goodbit rate for web video playback.

So we will leave that at 192.All right, then we will click Next.Now the output format, it says here the Encapsulation format.It's also the container format that we talked about before and for the MP3we are going to select the RAW container format, because remember I said that theMP3 format is the one that doesn't actually have a container format.So we use the RAW format here then click Next.Then we are going to choose a folder to put it in, so we are going to use theencoded folder inside of our _audio assets folder,just like we did with video,and save it there and I am going to call it podcast-audio.mp3.

Now it's going to yell at us and says it doesn't want to use the mp3extension for the RAW format.So for now we will just say use .raw, then actually in this save file dialogbox we can change it from .raw to .mp3 and it will keep that for us.So let me click Next and it gives us a summary of all the settings, which alllook right so I am going to click Finish.It's going to look like it's playing it, but what it's actually doing isencoding the file and now it's done. And if we go over to our folder and lookin our _audio encoded folder, I am going to see we now have ourpodcast-audio.mp3 file there. Great! That worked.

Let's go and create our other two versions which we can do both in VLC.We will go back up to our Streaming/ Exporting Wizard. Transcode/Save to file,Next, and the same source file, click Next, and we have Transcode audio, andfor this one we need to do MPEG 4 audio and this is going to be our aac format.Let's click MPEG 4 audio and keep the Bitrate at 192 and then click Next, and thenfor our Encapsulation or container format we are going to select the MPEG 4/MP4format and we will choose the location, and it already has the location ofour last one so actually I can just go over here and change the extension towhat we want it to be and that's m4a.

That is our podcast audio m4a. All right then we can click Next.It gives us a summary again. And click Finish and it's encoding it and we cansee it has already created in that folder. All right!One more time let's do this for our OGG format.So Files > Exporting Wizard, Transcode, select the source, and now for the Codec wewant to select Vorbis.Vorbis is our audio codec for OGG Vorbis format and we can keep it at 192 bit rateand click Next and we will have one option for the container format, OGG.

So that's easy and then we can change the extension and our output name andthat will be .oga and click Next. Get a summary and click Finish and it'screating that format.You can see it's already created it and it's building it in our folder.Now we have our three versions.Let's go ahead and plug those into our code.Go back to our text editor and scroll down to our audio tag.We can plug in the two versions that we need and they are now in the encoded folder.

I will do that for both sources and save that and so now the m4a version shouldplay in Safari, while the OGG version should play in Firefox.So let's open up Safari first and reload the page and scroll down to ouraudio and play that. (Music playing) All right! And we can see that worked.So let's go over and make sure it worked in Firefox.I am going to open up our Podcast page, reload.

(Music playing)All right. It shifted down therebecause of the Firefox issue that kind of puts space above the audio player, butthe audio file worked and so those two versions worked.Let's go ahead and try the mp3 version just to make sure that worked in casethat's the version you want to use.So I am going to replace the m4a with mp3 and open Safari again, reload and play that.(Music playing)So that's working as well.Okay, so all the audio formats work and with that now we know how to create allthe audio and video files we need for HTML5.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Already a member ?

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships.
Learn more

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.