[FFmpeg-user] How to decrypt .ts files into separate .ts files with ffmpeg without using a playlist?
Micael Silva
micaelsilva at gmail.com
Tue Feb 11 00:36:58 EET 2020
On Mon, Feb 10, 2020 at 6:16 PM Crazy Red Elephant via ffmpeg-user <
ffmpeg-user at ffmpeg.org> wrote:
> This works, Moritz, thank you. However, for some reason it works only for
> the part0 file, two others don't open in Windows Media Player after
> decryption. That's weird...
>
> What's also interesting is that there's about 17 KB difference in size
> between the part0 file decrypted with openssl (3,476 KB, which is 16 bytes
> less than the original encrypted one) and part0 decrypted from m3u8 (3,496
> KB). Do you have any idea why it's like that?
>
> Another thing is that I'm getting a "hex string is too short, padding with
> zero bytes to length" message but I suppose is fine since we use -iv 0...
The HLS standard says about encryption:
"An encryption method of AES-128 signals that Media Segments are completely
encrypted using the Advanced Encryption Standard (AES) [AES_128] with a
128-bit key, Cipher Block Chaining (CBC), and Public-Key Cryptography
Standards #7 (PKCS7) padding [RFC5652]. CBC is restarted on each segment
boundary, *using either the Initialization Vector (IV) attribute value or
the Media Sequence Number as the IV*; see Section 5.2."
In this case the IV for decryption of the first segment should be 0x0, the
second 0x1 and so on and so forth.
More information about the ffmpeg-user
mailing list