Videos uploaded on Youtube or any other video streaming website can be easily downloaded by using 3rd party software.

In order to prevent the viewers from sharing the video to unauthorised people. I thought of this solution.

  • Encrypt the video file using bash.
  • Send the folder using any file sharing service.
  • The user will run the bash file in order to decrypt the video.
  • The bash script will fetch the key from my server.
  • Then it will decrypt the video file and run it.
  • When the file will close, the bash script will encrypt it again.
  • The key on my server will expire on a specific date.

The users are not very tech savvy to understand what is going on behind the scenes. But this will protect my videos from piracy.

Is there any better solution for what I want to achieve? As this is not a cross platform solution.

EDIT : I am fully aware that it is very simple for a user to read the bash script and fetch the key. I am just trying to create an illusion that the video cannot be copied.

  • That is exactly what is done using certificates for videos so far. EME (Encrypted Media Extensions) by the W3C is currently what is meant as DRM for HTML5. – Daniel Ruf Apr 19 '17 at 10:33
  • 4
    The big problem of videos is that the user can easily record the screen, and there's nothing much you can do about that. Only if you could put watermarks with the user full name. – Ricardo Reimao Apr 19 '17 at 10:35
  • Yup, a video capture card or some clever software will still be able to make a copy. You can't prevent it, but with encryption you can make it a bit more difficult to do (and reduce blame on the delivery man). – daniel Apr 19 '17 at 11:17
  • 4
    Well if you are trusting your users to act a certain way then maybe just ask them nicely not to copy the video. – daniel Apr 19 '17 at 11:45
  • 2
    one does not need to be tech savvy to record a screen. YMMV. – niilzon Apr 19 '17 at 12:53

The user will run the bash file in order to decrypt the video.

The bash script will fetch the key from my server.

That means all the user needs to do is take a look at the sourcecode of the Bash script to get the URL the key is downloaded from. They can then download it via WGET and decrypt the file on their own. Alternatively they could create a copy of your Bash script and delete the lines which causes that:

When the file will close, the bash script will encrypt it again.

If Digital Restriction Management (DRM) would be such an easy problem to solve, we wouldn't have that much video piracy. If a system has the information required to play a video, it can create a copy of that video. So all DRM systems must rely on security through obscurity and on getting software to not do what the user wants it to do. That's why it is virtually impossible to have effective DRM in an open source ecosystem. But on Windows there is Protected Media Path which does its best to prevent the user from unauthorized access to a file.


When something goes public (let say EME as Daniel Ruf mentioned), first it gets some specification and protocol.

The next part is the implementation, now people and companies grab the protocol and implement it.

Even if you assume EME uses a strong cipher(let say AES_256_GCM), it's simply insecure just like it's not secure. Because as you would read the specification, you would implement your own code.

At the end all of these encrypted stream/descriptor must be in plain form where the client can display, at this phase you would simply write down the plain stream/video with a common format(h265/HEVC for instance) in a file.

This situation is special for the video and audio. Or generally most rich media(not all of them)

If it was really possible, hollywood could do it of course no doubt, but it's not very logical and possible yet with the way we stream video.

daniel also mentioned more logical and reliable solution. Yes you need to just ask people nicely to respect the copyright.

Not just video, even for many other stuffs that you could get some level with 1 year of research and coding, you would keep working on the system to keep it update and updated with people's needs instead.


DRM software serves this purpose. YouTube is already using DRM service for a paid content or premium content. Movies are protected with Widevine CDM.

Can this technology be applied to users which uploaded content? I think so, but it's all up to google.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.