>>689
ちょっと前進
tsの頭1KBの後の部分データ(*1)をAES-CBCで復号(*2)、それを新たな頭として、tsの残りをくっつけて出力
 (*1) データの長さはtsのバイト20~23で示される(見た感じ1040で固定ぽい)
 (*2) keyはその位置がtsのバイト16~19で示される、ivは固定: shortmax00000000
 tsの頭が shortmax0000000101971040qLKp9tU 〜なら、データの長さは1040、keyの位置はバイト0197から(16バイト分)
これを各tsに処理するとできる(はず)

#! /usr/bin/env python3

from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad

ts_file = "segment-0.ts"
with open(ts_file, "rb") as f:
in_buff = f.read()

key_pos = int(in_buff[16:20])
enc_data_len = int(in_buff[20:24])
key = in_buff[key_pos:key_pos+16]
iv = b"shortmax00000000"
enc_data = in_buff[1024:1024+enc_data_len]

cipher = AES.new(key, AES.MODE_CBC, iv)
dec_data = unpad(cipher.decrypt(enc_data), 16)

out_buff = dec_data + in_buff[1024+enc_data_len:]
out_ts_file = f"new-{ts_file}"
with open(out_ts_file, "wb") as f:
f.write(out_buff)