Sunday 11 February 2018

How to Download and Save Videos from a Website

I recently watched a free video embedded in a website and wanted to save the video itself for future reference (imagine the nerve!). The video content was delivered via the Brightcove player and was not a Flash/.swf file which I could otherwise deal with using traditional video download tools or shonky websites. The video was in fact, I believe, an HLS m3u8 video… admittedly, I don’t know if those are the same thing, or for that matter, what they are, and I don’t particularly care.

Rather than download a suspicious installer and infect my computer with the latest crypto virus, TubeOffline provided a handy and relatively simple tutorial using the ever trusty (and trustworthy) VLC media player. I’m reproducing the steps here in simple terms for future reference.

  1. Firstly, find the URL to the .m3u8 file you want to save. In Chrome, hit F12 and go to the Network tab. Check the Disable Cache button. Make sure the Record Network Log button is red and type “m3u8” (without quotes) in the Filter box. Load (or reload the page containing the video you’re after) and have a look at the network log. I grabbed the URL to the master.m3u8 file (right-click, Copy > Copy link address).
  2. From the Media menu in VLC, select Open Network Stream. It should open to the Network tab
  3. Copy the URL of the .m3u8 file to be downloaded and paste it in to the Network URL box. Don’t click the Play button!
  4. Click on the arrow next to the Play button and select Stream
  5. Click Next on the Source screen
  6. At the Destination screen, ensure the destination is set to File and click the Add button. Browse to the location where you want to save your downloaded video and specify a file name. The Save as type box will be left as Containers.
  7. On the Transcoding Options screen, leave Profile set to the default (Video – H.264 + MP3 (MP4). You can disable transcoding if you like but file sizes will likely be larger.
  8. On the Option Setup screen, leave the Stream all elementary streams checkbox un-ticked. Click the Stream button.
  9. VLC will begin saving the video to the selected file. Don’t try and play the video and don’t touch anything until the blue progress bar in VLC has reached the end (the far right side). You can sometimes monitor the file itself by hovering over in the file system to keep an eye on its size.

In practice, I noticed the blue progress bar reached the end and the file size was showing as 132MB. I thought it was all finished at that stage but opening the .mp4 file to review in a new VLC instance opened a whole lot of nothing with a duration zero seconds. After another minute or so, the file size bumped up to 133MB and opening the file again revealed the downloaded video complete with audio. I’ve found closing the original VLC instance seems to finalise the download/flush the last few bits to file (note: don’t just close the video or open another file—completely close VLC so it can flush its buffers and clean up). Your mileage may vary.