Extract Audio From Youtube HD MP4 Video Files

What if you want to get the audio file corresponding to one of the HD videos that you like on Youtube? It is very easy if you have a linux box to run a few simple commands. This post would also tell you how to convert an aac or m4a file to mp3.

First step is of course download the mp4 file corresponding to the HD video from youtube. This is described in an earlier post here. This step can be easily achieved by using a simple Firefox plugin called DownloadHelper.

Now that you have downloaded the Hi-def video file.We would go about conversion using avconv which is now the preferred Audio/Video converter replacing now deprecated ffmpeg. You may need to install it on Ubuntu using following command:

Of course there would be better ways of doing this, but this does the job. Text highlighted in blue is of our interest. It is most likely that the HD video file would have audio in aac format. If that is the case then run the following command to get the audio extracted:

avconv -i INPUT_FILE.mp4 -map 0:1 -c:a copy OUTPUT_FILE.m4a

Now if you are not happy with m4a format and want an mp3 as well. I would recommend you to use pacpl (Perl Audio Converter, sudo apt-get installpacpl) and run following command to convert the m4a file(s) to mp3