Category: youtube-dl

One liner to convert Youtube video to MP3

Many times we want to listen to songs, discussions or discourses which are in youtube on the go… Here is the quickest way to convert youtube video to audio by one command.


  1. LINUX OS (Debian preferably ๐Ÿ™‚
  2. Install youtube-dl (apt-get install youtube-dl)
  3. Run the command in terminal – youtube-dl -x –audio-format mp3 <youtube link>
  4. That’s it copy the mp3 file to pod/phone and you’re ready to listen on the go!!

Convert youtube videos to MP3 audio

My father-in-law who is a music enthusiast was trying to search for Ustad Ghulam Ali’s Ghazals.

He was able to watch and listen his Ghazals from YouTube at my place but he doesn’t have internet at his home. So, I decided to help him by downloading and convert songs to MP3.

Step 1:

I did google and found “youtube-dl” (for Debian Linux) and installed it on my Debian Linux. youtube-dl helped me to download playlists by running below command.

youtube-dl –playlist-start 1 –playlist-end 20

We can further specify output format, quality etc.. but for us basic download of the Ghazals was sufficient.

Step 2:

I did search for a tool to convert MP4 to MP3 in Debian and found a tool called “avconv”. Installed and started converting the downloaded files by running the below script all at once ๐Ÿ™‚

for i in *.mp4; do avconv -i “$i”ย  “out-$i.mp3” ; done

Above one liner script would convert all MP4 video files to MP3 audio files with the prefix “out” inย  the file names.

Result: We now have the offline Ghazals in mp3 format ready to listen in my father-in-law’s iPod / computer!!

Note: youtube-dl would not download copyrighted, restricted and private files from YouTube.