Video Encryption Fails while transcoding MPC | Transcoding Video Encryption Error.
(1) What to place in .withUrl ? for video encryption while video transcoding.
// Set the URL to obtain the key. .withUrl("www.xxxxx.com")
Core Code
Create an encryption request.
The request includes the input file, output file, and encryption parameter settings.// Set the paths of the input and output files.ObsObjInfo input = new ObsObjInfo().withBucket("mpc-east-2").withLocation("cn-east-2").withObject("input/hls/index.m3u8");ObsObjInfo output = new ObsObjInfo().withBucket("mpc-east-2").withLocation("cn-east-2").withObject("output");// Create a request.CreateEncryptTaskRequest req = new CreateEncryptTaskRequest() .withBody(new CreateEncryptReq().withInput(input).withOutput(output) .withEncryption(new Encryption().withHlsEncrypt(new HlsEncrypt() // Set the encryption algorithm. .withAlgorithm("AES-128-CBC") // Set the URL to obtain the key. // Set the initialization vector. .withIv("xxxxxxxxxxxxxxxxxxx") // Set the key. .withKey("xxxxxxxxxxxxxxxxxxxxxx"))));// Send the request to MPC.CreateEncryptTaskResponse rsp = initMpcClient().createEncryptTask(req);// Print the response message.System.out.println("CreateEncryptTaskResponse=" + JsonUtils.toJSON(rsp));
Architecture to Implement as Following: