[FFmpeg-user] How to decrypt .ts files into separate .ts files with ffmpeg without using a playlist?

Moritz Barsnick barsnick at gmx.net
Tue Feb 11 00:26:26 EET 2020

On Mon, Feb 10, 2020 at 21:16:36 +0000, Crazy Red Elephant via ffmpeg-user 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...

Well, ffmpeg parses the individual decrpypted segments just fine, so
*shrug*. I can only guess that when segmenting, they weren't segmented
at MPEG-TS packet boundaries, or something like that.

> 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?

The explanation for the 16 bytes is probably padding (for AES). I'm
somewhat new to this, so feel free to correct me. ;-)

What do you mean with "part0 decrypted from m3u8"? When using ffmpeg to
decrypt via m3u8? Well, you need to consider that "ffmpeg -c copy" does
demux and remux, and ffmpeg's MPEG-TS muxer does not (cannot) copy all
the properties of the original container. It's simply a different file,
though the contained multimedia streams should be identical.

> 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...

Probably. My openssl-1.1.0i didn't care.


More information about the ffmpeg-user mailing list