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

Micael Silva micaelsilva at gmail.com
Mon Feb 10 17:55:04 EET 2020

On Mon, Feb 10, 2020 at 10:41 AM Crazy Red Elephant via ffmpeg-user <
ffmpeg-user at ffmpeg.org> wrote:

> Hi,
> I have a number of .ts files, .m3u8 playlist and a key to decrypt them.
> The key is a file, not a hexadecimal string. My goal is to decrypt some of
> these .ts files to analyze them individually. I also obviously don't want
> to modify the actual video/audio streams in them in any way, just a
> decryption.
> I have no problem decrypting them as an .m3u8 playlist into one big .ts or
> .mp4 file with a simple command like "ffmpeg -allowed_extensions ALL -i
> chunklist.m3u8 -c copy output.ts", I just use URI=key in the playlist and
> it works. But I need them to be decrypted into separate files, not one.
> I could probably just leave only one line in the playlist and decrypt them
> one by one like this but I want to learn how to do it properly.
> I tried opening the key file in a hex editor (which is probably a dumb
> thing to do) and then using the hex value in a command like "ffmpeg
> -decryption_key {hex_value} -i part1.ts part1.ts" but it gives me the
> "Invalid data found when processing input" error...
> So how to do this properly? The ffmpeg documentation wasn't helpful...
> [Here](https://www.mediafire.com/file/twsn7mdew9aa8lx/test.zip/file) are
> the files I'm working with in a zip archive. I've included only three of
> the .ts files there, that should be enough for a test.
> Any help will be greatly appreciated. Thanks!
> ~ Red Elephant.

You can decrypt single files using "ffmpeg  -key (hex key) -iv (hex IV,
required) -i crypto+file:/path/to/file.ts"

More information about the ffmpeg-user mailing list