In function encrypt, the for loop is written on the basis of there only being one bitrate, and so generates an IV based upon the segment number
count=0
for file in ${OUTPUT_DIRECTORY}/*.ts
do
ENC_FILENAME="$OUTPUT_DIRECTORY/${SEGMENT_PREFIX}_enc_${count}".ts
INIT_VECTOR=$(printf '%032x' $count)
If we've got an ABR stream with 3 bitrates, containing 5 segments each, then when we move onto the second bitrate count is going to be at 6 (whilst we'll want it to be 0).
So the function almost certainly needs adapting to take bitrates into account rather than simply iterating over files.
Apple's technote (
https://developer.apple.com/library/content/technotes/tn2288/_index.html ) specifies that
The default Initialization Vector for media encryption (if none is specified) is the sequence number of the media file. You should specify an Initialization Vector value, and not rely on sequence numbers. The main reason for this is portability. For example, if you change where the segment appears in the playlist (e.g. inserting an ad), that changes its sequence number, requiring a re-encrypt.
So this is almost certainly going to be an issue. Longer term, it'd be better to follow their advice and set a specific IV (which will mean rewriting the manifest), but in the short term need to make the sequence numbers work as a minimum
Activity
2017-04-29 09:53:38
For a single bitrate (where the -b argument hasn't been used at all) it'll be
When generating the IV, we're only interested in the segment number, so we can probably just iterate over the files and extract the segment number from the filename to then use as the IV.
2017-04-29 10:09:23
Doi
I'm gonna drop a check for that in (HLS-23) once I've got this sorted, it was introduced in https://github.com/bentasker/HLS-Stream-Creator/commit/0796febbc73d9b96c7ee58864e6ce79c9ff71b4d - I'm running a fairly recent install, so I suspect a few people may hit up against that
2017-04-29 10:09:30
2017-04-29 10:19:10
2017-04-29 11:11:00
For now, I've done it with sed, but it's irritating. Want to get around to having a look at shopt and the like when running to see if I can figure out why. Running the same loop manually in a shell, it works fine.
2017-04-29 11:12:51
Webhook User-Agent
View Commit
2017-04-29 11:12:53
2017-04-29 11:13:32
2017-04-29 12:07:25
2017-04-29 12:07:25
2017-04-29 12:07:29