14

Is it possible to protect a video from a site from being downloaded?

While users could record a video by using some hardware device, it should not be possible to download a video using some link - exactly like google videos.

For example, if I have Real One Player in my system, I have an option to download the video; this should be restricted.

Anders
  • 8,307
  • 9
  • 56
  • 88
Fero
  • 12,969
  • 46
  • 116
  • 157
  • 26
    You may protect your video if you don't let users to watch them. – Ahmet Kakıcı Nov 24 '09 at 13:53
  • nope.. my users can able to watch the video. but they must not be able to download that video – Fero Nov 24 '09 at 13:57
  • 11
    When you let your users to watch the video that means you send your bytes to users. So they may save and watch it again and again. You may do some tricks to hide or encode your video url/data but don't forget: You can run but you can't escape :) – Ahmet Kakıcı Nov 24 '09 at 14:01
  • 3
    They have to download it to watch it. I think you mean "they must not be able to save it on their computer for later viewing". – Grandpa Nov 24 '09 at 14:04
  • 2
    This question has been substantially changed from when it was originally asked. How did we get from "how do I protect my content" to "how do I download Google video"? – Brad Nov 24 '09 at 14:51
  • 3
    The only way of completely protected those videos from being "viewed at a later time" is to not let them be watched. Even if you can manage to do some FLV madness and prevent downloading, there are still screen recorders. – Earlz Nov 24 '09 at 15:00
  • You buy a circus tent. You let people in one at a time. You charge nickels and have a big sign that says 'NO RECORDING EQUIPMENT!' Tried and true methods are always the best. – LoveMeSomeCode Nov 24 '09 at 14:54
  • You can't protect, but can make it's downloading much harder for a regular user https://stackoverflow.com/questions/9756837 – stkotok May 05 '21 at 13:14

10 Answers10

61

Yes. Never ever show it to anyone. As soon as you do, all bets are off (for less paranoid answer, see last paragraph).

This is the common problem with copy protection: you are unable, by any means, to distinguish between a legitimate user and an adversary (as they may even be the same person).

Edit: re "my users can able to watch the video. but they must not be able to download that video" Let's try and disassemble this:

  • the user clicks the mouse on your player's "Play" button
  • the click goes through the computer's OS to your player
  • the player sends a request through the network "send me teh videos" to your server
  • (this, by definition, requires that the request goes through the whatever networking stack the user's computer has)
  • the server, if it decides that it's a legitimate player, begins sending data to the user's computer.
  • (this, also by definition, means, that the user's computer is "downloading" the data)
  • *the data comes through the network into the computer (although capturing the data at this stage is more practical for the NSA than for a user)
  • *the OS handles the lower data layers (i.e. "this is a data packet, from $yourserver to me, and should be passed on to $yourapp")
  • *the OS passes the data to the app that requested it
  • the player receives the data
  • *the player transforms the data into a sequence of images (a.k.a. a video) and a sound track
  • *the player sends the images to the OS's display subsystem, or saves it to disk
  • *the display system transforms the images into a format the screen understands
  • *the images flow through a cable into the screen
  • *the images are displayed on the screen (at which point they exit the computer in form of light)
  • the light reaches the user's eyes

Your video can be intercepted (and/or modified) at every point marked with * (although quality of the copy may decrease, esp. when capturing the analog output). Unless you can somehow eliminate each and every of those (good luck with the last one), all you can do is make the data capture/transform more complex. There's a whole industry built around these "weak points" (google "stream ripping" to see for yourself).

You can complicate the capture with various DRM technologies, but in the end, the data stream must become analog video and analog audio (a.k.a. light and sound) somewhere.

However, if you don't care that a determined user will bypass your protection, and if it's enough to protect the video from 90% of users, I believe the Real formats that you mentioned do have some flag "don't allow save". This will disable the "save as" option in the player (i.e. the "or saves it to disk" option above); for most users, this will be a significant enough barrier. Anything more will probably inconvenience and anger 100% of your users, while not providing significantly more protection.

Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
  • nope.. my users can able to watch the video. but they must not be able to download that video – Fero Nov 24 '09 at 13:57
  • This is so trivial I'm surprised that it has to be explained to people. – Tamas Czinege Nov 24 '09 at 14:06
  • 2
    Trivial, maybe. Obvious, not really. – Piskvor left the building Nov 24 '09 at 14:12
  • What about reducing the resolution (through an encoder, etc), then providing a downloadable high quality version? – CodeJoust Nov 24 '09 at 14:17
  • 7
    @Fero: what you are asking is *IMPOSSIBLE* - you can make it more difficult, but it's ultimately impossible to prevent. – Chris K Nov 24 '09 at 14:35
  • 3
    I like the list of stages and points of interception in this answer. – Mayo Nov 24 '09 at 14:48
  • +1 for a great answer even though I sense a bit of sarcasm in it it´s probably what I would answer aswell. People that think they have something to protect shouldn´t even be on the net. Tyler Durden´s snowflake quote comes in mind more then ever. – anddoutoi Nov 24 '09 at 14:52
  • 1
    It should be noted that while it is possible for someone to "record" the video in the latter few steps, it's still impossible to get the exact video data after it's being displayed. In other words, you can set up a screengrab program, or a video camera in front of your monitor, but by definition the video will be worse quality than the actual data you received. – DisgruntledGoat Nov 24 '09 at 15:02
  • "but by definition the video will be worse quality than the actual data you received" how is this true for a screen grabber? Assuming your computer is fast enough to handle playing the video and recording with the screen grabber, how will this decrease the quality at all? – Earlz Nov 24 '09 at 15:04
  • 1
    @earlz: Unless you're saving your files as bitmaps, with full resolution, and creates a video with a lossless compression mechanism, yes, it's going to decrease quality. The same with audio. – GmonC Nov 24 '09 at 17:04
  • 10
    **Did you know?** In Safari, you can click on Window > Activity to display all the file transfers going on in the background. You can hold the Alt key and double click any of these transfers to save them to disk. If you're using any sort of player that requests and downloads separate files, like .flv files, this is a trivial method to save the raw data. Most browsers offer features like this. ;) – deceze Nov 25 '09 at 08:15
13

If the user's eyes can see the video, the user's recording device can also see the video. There is not now, and never will be, a way to prevent users from recording content which they are viewing/listening to. It is an unsolvable problem.

Brian Schroth
  • 2,447
  • 1
  • 15
  • 26
  • 2
    yeah, this is an interesting problem because if you take no precautions, the layman can just click 'Save As'. If you take some precautions, the tech savvy will find away around them, but even if you take a lot of precautions, the layman can just set up a video camera or screen grab application. – LoveMeSomeCode Nov 24 '09 at 14:51
  • 11
    The most important thing to note, of course, is any "precautions" you take are likely to infuriate your users, who just want to *watch the god damn video*. – Brian Schroth Nov 24 '09 at 15:00
  • 1
    yeah, it really makes you question the whole process. you want them to see it, but you don't want them to see it later? If it's because you have tons of ads all over your page, i guess you could just put ads in the video, though that'd be a little harder to get click thru counts. – LoveMeSomeCode Nov 24 '09 at 15:26
  • Let's say I have a course website, where the lessons are displayed in videos, you must be logged in to have access to that video, anytime you want, wherever you want. But the video should not be allowed to be downloaded by anyone so easily, or at all (that would be wonderful) because you don't want them to distribute these videos to family, friends etc so they can learn for free without paying for our services... – user3050478 Jan 31 '20 at 04:14
6

If users can "watch" a video, they can always find a way to save it to disk. You could watermark a copyright message over your videos but I am afraid that's about it.

Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
Salman A
  • 262,204
  • 82
  • 430
  • 521
5

It is impossible to prevent a video from being downloaded. For the video to be displayed on the screen, the bits that make up the video must be transmitted to the users pc - which you have no control over.

All you can do is make it difficult.

For example, use css to display a transparent image over the video so to make it hard to right-click the video and view its properties (Flickr do with with pictures).

Or use obfuscated html/javascript to make it hard for a user to do View->Source. But a sufficiently determined user could unobfuscate it, and you can't disable View->Source because you don't own the user's pc.

You could go further and use a custom (secret) video file format and brower plugin, or use a seperate realmedia-style playback client. These are likely to annoy your users, though, and doesn't stop someone from reverse-engineering your protocol/format and writing their own client to impersonate the browser and save the video in a standard format.

I don't advocate doing any of the above!

Bottom line: you have to send the bits to the user's pc, and once you do that you lose all control over them.

Andy Johnson
  • 7,938
  • 4
  • 33
  • 50
4

@Fero

Instead of Putting Your video in web site, Setup Remote Desktop in your Home Computer.

Open Login account for each users manually, and Let users login,

And Let the users watch your movies through it, and

You can also monitor them one by one too, without sleeping.

May be thats the way to go!

YOU
  • 120,166
  • 34
  • 186
  • 219
3

To be upfront, nothing is bulletproof. For every protective measure developed, someone has found a way to defeat it. However, you can take some steps to stop (or at least slow down) the casual user.

The Real Networks platform offers quite a few options for protecting content, the safest of which is generally streaming it live or on-demand.

In order to give you specific directions, we'll need more information, though. You mention that Real One Player is giving a 'save' option. It can play several formats. What type of file are you posting (Real, WMV, etc) and how is it currently being served (link, embed, stream).

Brad
  • 1,357
  • 5
  • 33
  • 65
3

It is impossible to effectively stop a user from saving your video one way or another. A desperate one might actually record the entire screen content while it is being played.

Aaalf
  • 131
  • 1
  • 6
1

Fero, this is a subject that a lot of big entertainment corporations are facing it everyday. "But how can I stop people copying my stuff"?

You can difficult it, but as you difficult people watching, people are less inclined to use your system unless you give the most important information they have ever seen. If a login barrier is a concern, imagine forcing people to use Real Player.

Trying to make your videos famous and relevant are better than try to encrypt at any costs before they are important.

GmonC
  • 10,924
  • 1
  • 30
  • 38
1

You can protect video from downloading if you are using html5 video.

Here is an opensource script which you can try and there is no way to bypass it for now : http://sourceforge.net/projects/defaprotecthtml5videodownload/

It is using way of special algorithm which doesn't send you a original video files but sending files with rules so it can stop your video from downloading

John Lee
  • 19
  • 1
  • Going to suggest same. Its working fine also for audio. But if you place both video and audio on page, only last one works. & others won't. Have you face same problem ? – Vishal Tarkar Mar 09 '16 at 10:42
0
   //test.php
 <video controls src="your/path/1502139559.mp4"></video>
    <?php

      if (session_id() == '') {
       session_start();
      }
      error_reporting(0);
      $out2 = ob_get_contents();
      if (strpos($out2, "<video") || strpos($out2, "<audio") || strpos($out2, "<source")) {
       ob_clean();
       if (strpos($out2, "<safe") == false) {
        $window = md5(time());
        $_SESSION['window'] = $window;

        ?>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
        <script>
         jQuery.ajax({
          type: "POST",
          url: "/enable.php",
         });


        </script>



        <?php

        if (strpos($out2, "<safe") !== false) {
         $_SESSION['safe'] = "SAFE";
        }

        function getURL($matches) {
         global $rootURL;
         if ($_SESSION['defat'] == "") {
          $_SESSION['defat'] = 1;
         } else {
          $_SESSION['defat'] = $_SESSION['defat'] + 1;
         }
         $_SESSION['x' . $matches['2'] . $_SESSION['defat']] = 0;
         $_SESSION['defa' . $matches['2'] . $_SESSION['defat']] = md5(time() . "Defa Protector");
         $_SESSION['imdefa' . $_SESSION['defat']] = md5('Defa') . base64_encode(base64_encode($matches['2']));
         $_SESSION['x' . $matches['2']] = 0;
         $_SESSION['defa' . $matches['2']] = md5(time() . "Defa Protector");
         $_SESSION['file' . $_SESSION['defat']] = md5('Defa') . base64_encode(base64_encode($matches['2']));
         return $matches[1] . $rootURL . "defavid.php?window=" . $_SESSION['window'] . "&defat=" . $_SESSION['defat'];

        }

        $mes = preg_replace_callback("/(<video[^>]*src *= *[\"']?)([^\"']*)/i", getURL, $out2);
        $mes = preg_replace_callback("/(<source[^>]*src *= *[\"']?)([^\"']*)/i", getURL, $mes);
        $mes = preg_replace_callback("/(<audio[^>]*src *= *[\"']?)([^\"']*)/i", getURL, $mes);
        echo $mes;
       } else {
        echo $out2;
       }
      }

    ?>
    //defavid.php
    <?php

      ob_start();
      if (session_id() == '') {
       session_start();
      }
      $window = addslashes(strip_tags($_GET['window']));
      $md5defa = md5('Defa');
      $t = (int) $_GET['defat'];
      $filedefa = str_replace($md5defa, '', $_SESSION['file' . $t]);
      $file = str_replace("https://", "http://", base64_decode(base64_decode($filedefa)));
      $defa = str_replace("https://", "http://", base64_decode(base64_decode($filedefa)));
      $defaurl = get_headers($file, 1);
      $url = $defaurl["Location"];
      if ($url != $file && $url != "") {
       $file = $url;
      }
      if (!function_exists('http_response_code')) {

       function http_response_code($newcode = NULL) {
        static $code = 200;
        if ($newcode !== NULL) {
         header('X-PHP-Response-Code: ' . $newcode, true, $newcode);
         if (!headers_sent())
          $code = $newcode;
        }
        return $code;

       }

      }
      $header = http_response_code();
      $header2 = getallheaders();

      function isMobile() {
       return preg_match("/(MSIE|Edge|android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);

      }

      if (isset($_SESSION['jsenable' . $window])) {
       if ($header == 200 && $header2['Accept'] != "" && $_SESSION['x' . $defa . $t] == 0 && isMobile() || isset($_SERVER['HTTP_RANGE'])) {

        $_SESSION['x' . $defa . $t] = $_SESSION['x' . $defa . $t] + 1;
        if (isset($_SERVER['HTTP_RANGE'])) {
         $opts['http']['header'] = "Range: " . $_SERVER['HTTP_RANGE'];
        }
        $opts['http']['method'] = "HEAD";

        $conh = stream_context_create($opts);

        $opts['http']['method'] = "GET";

        $cong = stream_context_create($opts);

        $out[] = file_get_contents($file, false, $conh);

        $out[] = $http_response_header;

        ob_end_clean();

        array_map("header", $http_response_header);

        readfile($file, false, $cong);
        die();
       }
      }

    ?>
    //enable.php

    <?php
    if(session_id() == ''){
         session_start(); 
    }
    $window = $_SESSION['window'];
    $_SESSION['jsenable'.$window] = TRUE;
    ?>
debasish
  • 735
  • 1
  • 9
  • 14
  • How does that solve the problem? This just complicates matters, *will* break non-whitelisted browsers, and is bypassed by any of the following: https://www.techsmith.com/screen-recorder.html – Piskvor left the building Oct 31 '18 at 09:49