download YouTube (videos | mp3) without browser extension using only VLC

There is a multitude of browser add-ons and extensions available for downloading YouTube videos or converting to mp3 that are usually somewhat obscure, but there is actually nothing more needed than the popular VLC player. Here is how!

true
2018-05-05

// Introduction

In our HowTo download “Mediathek” features for archival purposes we looked into how to download features from your typical German public broadcasting Mediathek.

We might want a similar solution to YouTube for having media available offline, e.g. for live presentations when internet service cannot be guaranteed.
Regrettably the same trick is not working for YouTube. Naturally, there is a multitude of browser add-ons and extensions available for downloading YouTube videos that might range from deprecated to outright malicious, but are usually somewhat obscure.

But, as of writing this, there is actually nothing more needed than the popular VLC player↗.
VLC is a feature packed, free and open source cross-platform multimedia player and framework that plays virtually all multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols.
Download here, as this is what we will use: https://www.videolan.org

// Download originial YouTube video with VLC

VLC does not only play music or videos from disk, but is also a complete software solution for video streaming that can be used to capture and transcode media streams, such as YouTube videos!
For information, also on the command line options see the documentation here: https://wiki.videolan.org/Documentation:Streaming_HowTo_New/

For the most straight forward approach we will go as follows:

  1. open YouTube video and copy the URL
  2. in VLC hit Ctrl + N
  1. paste copied link as network URL into VLC

  1. hit Play
  1. then Ctrl+J to view the Current Media Information
  1. Copy the URL given under Location

  1. paste the copied Codec-URL back the browser
  2. right click on video and save
$ curl "your_copied_Codec-URL_here" -o YT.mp4

// Download audio from YouTube with VLC

Similar to the above, we can use the Codec-URL to download only the Audio of the video, though not by niftily extracting the original audio stream, but simply by transcoding↗, which means some quality loss of course.

For downloading a MP3 off YouTube follow the steps 1-6 from above, then instead of pasting the Codec-URL back into the browser, paste the link back into VLC and instead of play we choose to Convert:

  1. Open YouTube video and copy the URL
  2. in VLC hit Ctrl + N
  3. paste copied link as network URL into VLC
  4. hit Play
  5. then Ctrl+J to view the Current Media Information
  6. Copy the URL given under Location
  7. type Ctrl + N again
  8. paste the copied Codec-URL back under network URL
  9. instead of hitting Play select Convert from the drop down:

  1. a new Window opens with the Codec-URL as Source

  1. press Play again to really start the conversion

  1. VLC will do the rest and show you the status in the progress bar

// Download video | audio from m3u or m4s with VLC

The same procedures can be used to play, download or convert M3U streams (or other) directly in VLC.
M3U files are basically a type of playlist, where the location of each item on the playlist is placed on a new line, and which are widely used by (German) public broadcasting for streams, instead the of un-split mp3 or mp4 files we could find otherwise in the Mediathek.
For that, simply download the m3u TXT file to local or paste the m3u’s link into the network URL again (via Ctrl + N) and follow the steps given under // Download audio from YouTube with VLC above.
For DASH (Dynamic Adaptive Streaming over HTTP) and its related .m4s media segment files, one has to identify the initialization segment, like pc_hd_abr_v2_nonuk_dash_master.mpd in BBC’s radio programmes. Conversion again follows the steps above.

Citation

For attribution, please cite this work as

Schmalfuss (2018, May 5). OS DataMercs: download YouTube (videos | mp3) without browser extension using only VLC. Retrieved from https://www.datamercs.net/posts/2018-05-05-download-youtube-using-only-vlc/

BibTeX citation

@misc{schmalfuss2018download,
  author = {Schmalfuss, Olaf},
  title = {OS DataMercs: download YouTube (videos | mp3) without browser extension using only VLC},
  url = {https://www.datamercs.net/posts/2018-05-05-download-youtube-using-only-vlc/},
  year = {2018}
}