inputstream.adaptive icon indicating copy to clipboard operation
inputstream.adaptive copied to clipboard

AES 128 key and IV via code

Open GladistonXD opened this issue 1 year ago • 2 comments

I made a continuous hls server, where I only get the .ts files, but it runs without decryption, is it possible to quickly customize the outputs?

from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
def decrypt_file(input_file, output_file, key, iv):
    cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
    decryptor = cipher.decryptor()
    with open(input_file, 'rb') as f:
        encrypted_data = f.read()
    decrypted_data = decryptor.update(encrypted_data) + decryptor.finalize()

    with open(output_file, 'wb') as f:
        f.write(decrypted_data)

input_file = 'video_encrypted.mp4'
output_file = 'video_decrypted.ts'
key = b'\xda\xde"\rZ\xa3+t\x11\xd9\xcf\x1a\x88\r\xfc\xdd'
iv = b'\xf4>\x06#\xc1>\x98X\x01\n\xea\x1dg 6\x14'

decrypt_file(input_file, output_file, key, iv)

video_encrypted.mp4 It would be something like this, but directly in input.adaptive or another faster decryption method in Kodi. #EXT-X-KEY:METHOD=AES-128,URI="/key/...",IV=... Would something like this be possible?

listem.setProperty('inputstream', 'inputstream.adaptive')
listem.setProperty('inputstream.adaptive.license_key', 'key=', 'iv=')

Or do something directly in the player via advancedsettings.xml If possible, someone can help.

GladistonXD avatar Apr 21 '24 10:04 GladistonXD

fwik you cant seem you want to simulate a live stream it is best to manage everything inside your HLS server by building the appropriate master/child playlists with the appropriate HLS tags

CastagnaIT avatar Apr 22 '24 12:04 CastagnaIT

I understood the concept, in this case, instead of launching the videos directly on the server, I would put them in the form of links with HLS tags along with the Keys in a traditional way, I thought there could be a group of this kind:

listem.setProperty('inputstream.adaptive.license_key', 'key=', 'iv=')

thanks.

GladistonXD avatar Apr 22 '24 12:04 GladistonXD