Using the youtube-dl command line application you can download videos and directly extract the audio of the video in various formats.
youtube-dl supports a large variety of online video hosts, including:
Note: Please be sure that you are allowed to download a video before you do that, many of these hosts do not expect that you will be downloading their videos as they do not allow that.
The following command, will download a video, convert it to an
mp3 and delete the original video:
youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=cwI-n3sI8ec
If you want to keep the original video, you just add the parameter
--audio-format parameter accepts other types of audio format outputs, specifically it supports
- best – this is the default value where it will convert it to whichever format it believes it would be best
- aac – https://en.wikipedia.org/wiki/Advanced_Audio_Coding
- vorbis – https://en.wikipedia.org/wiki/Vorbis
- mp3 – https://en.wikipedia.org/wiki/MP3
- m4a – https://en.wikipedia.org/wiki/MPEG-4_Part_14#.MP4_versus_.M4A
- opus – https://en.wikipedia.org/wiki/Opus_(audio_codec)
- wav – https://en.wikipedia.org/wiki/WAV
youtube-dl is a very powerful tool, advice the documentation for some of the great features it supports.