I recently bought Amazon Prime and wanted to download a movie. After downloading a media file it is all black. It looks like it's encrypted with some key, which the browser has.
My question is: Can i just compile the browser myself after adding some code to save the video element decrypted buffer to a file?
Most commercial video streaming services will use DRM to protect the content. The DRM systems control the sharing of a license between the server and the client device and player which includes the decryption key and also rules around how it can be used.
To view movies offline the solution will usually use persistent licenses - these have an expiry which is, for example, up to a month and are stored securely by the DRM systems the device to allow them be used offline.
Typically, the video streaming services will only offer a subset of their catalogue for offline viewing - I am guessing that may be the case for the content you want to view.
You can't access the decryption key directly yourself, unless the DRM system is broken.