1

I am streaming video files from the web using VLC player but most files I can only stream with a direct download URL to the file, as opposed to the file URL as it appears on the web.

To be specific, if I select the file URL on the web and click Copy Link Location, the copied URL will not stream. If I select the URL and click Save Link As..., a direct download URL is created which the browser uses to download the file; I can copy the new direct download URL by right clicking Copy Download Link on the saved file in the Downloads folder, even if the download is incomplete or cancelled. Currently I'm using this awkward workaround and I'm looking for a more sophisticated approach.

Here is a specific example I've encountered recently streaming large (3-4GB) .mkv files from a public Google Drive folder: this initial page contains an embedded player and some Google Drive buttons in the header. I click the download button leading to the next page warning me that the file is to large for virus-scan. If I right click the Download anyway button and select Copy Link Location, the copied URL does not stream but if I select Save Link As... (or just left click Download anyway) and start the downloading process, the direct download URL is generated, which I copy from the record that is created in the downloads folder.

My question is how can I create a direct download URL identical to the URL created when I download a file with my browser?

(Just out of curiosity: is the direct download link generated by the browser or by the server hosting the file? Is it possible to determine the format of a direct download link without first passing some query to the file host?)

  • Can you edit the question to include what file extension the videos have and what coding language you're using (e.g., HTML, HTML5, PHP...)? For HTML5, which most modern browsers support now, you should be able to use: <a href="link/to/your/download/file" download>Download link</a> or <a href="link/to/your/download/file" download="filename">Download link</a>. Your web server will have to support the MIME type for that file extension however, for example video/mp4 for MPEG-4 videos. – dan Jan 17 '18 at 7:59
  • @dan I added a simple example above. I am not using a single coding language per se because I'm not streaming files from just one place. I gather the download link formatting depends on the language that the host page is written in then? – isosceleswheel Jan 17 '18 at 12:20
  • I'm not streaming files from just one place Where are you streaming them from? We generally only deal with web servers here, questions about file-sharing, like with Google Drive, are best asked over at Super User. If you are using a web server, you'll need to make sure the MIME type is set correctly for .mkv so the client application (i.e., the browser) will know what to do with the file. All modern browser should support the link format I supplied above, which can be outputted by any script language. .mvk files however may not be supported by all browsers. – dan Jan 18 '18 at 1:08
  • @dan Thanks for your detailed input. As my post probably indicated, this is not my domain of expertise. My question was premised on the assumption that there were some general purpose principles for generating the types of URLs I specified for ANY (or most) kinds of clickable web links -- I used the Google Drive example because it was relatively straightforward to describe in a simple post but I see from your comment there the situation is more nuanced. I will try the HTML5 template you provided for an appropriate case and spend a bit more time learning about web servers – isosceleswheel Jan 18 '18 at 5:47
  • No problem. URLs for Google Drive are somewhat unique - I'm not certain that you can stream content from them as most file-sharing services aren't setup for that (it requires multiple socket simultaneous socket connections). Try to get a web hosting account, or use a local web server (they're not complicated to setup), and add a link to an HTML page. You should probably try using an .mp4 file first, since .mvk may require a codec or additional extensions to play it. Good luck. – dan Jan 19 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.