Copy link to clipboard
Copied
Hello!
I am developing a video player where downloaded video tutorials have to be played offline. The video files in mp4 format
I want to secure these video files. What is the best and economical way to encrypt these files per pc or per user
I am tracking the IP of the user's connection also some machine related information.
Can i use this information along with some encryption key to restrict the playing of the video file.
The users get these videos after paying for them. But once they get it, they can share it with others. I want to restrict that.
Please suggest me some ideas of how I can protect these videos from piracy.
Please help
Copy link to clipboard
Copied
Hi,
Unfortunately you can't encrypt an MP4 video file like how you want it, it's just not possible. Once the file is downloaded, nothing you can do to stop advanced users from distributing your videos.
However, I have some ideas you may consider (these are really just ideas from the top of my head):
First, if it's a browser app you can't do much, or it will be very difficult to manage files in network and local sandbox separately.
If it's a desktop/mobile app, you can do one of the followings:
I hope these can get your thoughts moving
Cheers
Tamas
Copy link to clipboard
Copied
Another idea
Copy link to clipboard
Copied
Hello Tamas,
Thank you for your response. It is a desktop application and the size of the video tutorial will be huge only. not less than 500MB. I have already done the first one.. Of naming the file without any extension. But my concern is that i don't want anyone to be able to share it if they get access to the file also.
Your second option of splitting the header and the video separately is a brilliant solution but the you are saying it does not work on iOS.
I just want that the mp4 has a string of data embedded in the file [meta data probably] and only once that is validated should the user be able to see the actual tutorial video.
And this needs to work on a Windows PC and a MAC PC. not required for mobile devices.
Do you think this is achievable?
Copy link to clipboard
Copied
If it's a desktop app (and only your app supposed to play back the videos) then you don't need to worry about iOS, it works on Mac (OSX)
Well, the most important thing is to somehow obfuscate the content of your video file and make sure you restore the original content just before playing and obfuscate again after playing stopped. You might need to experience a little, but changing 1000-2000 bytes at the beginning of the file shouldn't be difficult on any operating systems, especially on desktop. Just make sure internet connection is always needed and do not store the header bytes in a file, just download it right when the user click "Play" (Show a progress bar, like "Initializing...." or similar while you download the write the header content)
Method 2 is a lot more work, I already created something similar a couple years back. You have to take care of seeking and timing manually which can be challenging (if a user seeks to for example 1:15:10 then you have to load the appropriate bytes from the FileStream, which can be difficult for VBR videos), but this method might be more rewarding. I think you should try Method 4 first, it's a lot more easier