A couple of users have reported (in Github #15) that when they enable encryption, nothing happens
An example call provided is
./HLS-Stream-Creator.sh -i trailer.mov -s 10 -e -o trailer -b 272,872,1372,1872
When the issue was originally raised I ran a test and it seemed to work, but the original user never provided the further info I asked for.
Another user has reported the same issue (in the same thread) and has provided the commandline above, so need to revisit this
Activity
2017-04-26 19:57:35
2017-04-26 20:06:26
All looks fine so far.
Now with encryption enabled
That's running, but encryption doesn't happen until the end, so will need to wait for the transcodes to complete. Will have a look over the code while I wait
2017-04-26 20:16:27
I don't see anything odd on either stdout or stderr
I wonder if it might be a weird product of creating an Adaptive stream. Will re-run with a single bitrate and see if encrypt then gets called
2017-04-26 20:26:17
Was definitely working before?
2017-04-26 20:30:44
It's a result of the conditional at Line 353 ( https://github.com/bentasker/HLS-Stream-Creator/blob/4a9e0a019f3eed8036836b37c93e213a03c0fade/HLS-Stream-Creator.sh#L353 )
If bitrates have been specified in the argument list, we fork off down a different code path (because we need to spin up sub-processes etc). Processing effectively ends once awaitCompletion has done it's bit.
The call to encrypt happens in the other (smaller) code path, that we follow when bitrates haven't been explicitly specified, essentially everything below the else at line 438 ( https://github.com/bentasker/HLS-Stream-Creator/blob/4a9e0a019f3eed8036836b37c93e213a03c0fade/HLS-Stream-Creator.sh#L438 )
So the original pull request was wrong. Damn, I should've caught that
2017-04-26 21:00:00
Specify a single bitrate on the CL
Not perfect though, the m3u8 rewrite is using an incorrect manifest name
Thinking about it, the key will need to be written into the bitrate manifests (and not the master) anyway. I'm going to put that into a seperate commit
Test with no bitrate specified
And (expectedly) no complaints about not being able to find the manifest.
Checking playback
Playback fails.
Looking in the access logs, VLC is requesting a range
The 206 is just because VLC requests uses "Range: bytes=0-"
Getting 16 bytes back, which should be right, the HLS spec says
OK, need to look into that then. No point encrypting if you can't play back (the ultimate DRM :D)
2017-04-26 21:17:16
Something's done horribly wrong there :(
OK, lets manually run an encrypt and see where we get. Will use one of the cleartext segments from the tests where encryption didn't run. Using the same key as the one above
Which would suggest something's going wrong in script and affecting the segments themselves, rather than specifically being an issue with the key. As a starting point, have dropped an echo into the script and set a run going to see exactly what's being run
2017-04-26 21:23:41
If I remove the key definition from the manifest, the video plays, so the fragments aren't being encrypted. A quick check with xxd confirms
There's obviously something wrong with the for loop in encrypt. The complaints about invalid length are, of course, because the data's not padded (because it's not encrypted in the first place)
2017-04-26 21:26:12
Let's take the subcommand out of it (I don't particularly like the variable being called file either, but will fix that once I've sorted the iteration out)
2017-04-26 21:37:58
Though the commands being run now look more or less right (aside from the input file path being incorrect)
Next test run underway. I really wish I'd checked that pull more carefully, I'm not convinced this should ever have worked fully, unless you specified an absolute path for the output directory
2017-04-26 21:43:19
VLC no longer complains about the key, and ffplay can correctly play the stream back
VLC also plays back.
Will commit the fixes made so far, and fix the manifest location issue in encrypt so that this should all work with adaptive streams (as well as single bitrate streams where only one bitrate has been specified)
2017-04-26 21:44:51
Webhook User-Agent
View Commit
2017-04-26 21:44:52
Webhook User-Agent
View Commit
2017-04-26 22:02:27
No complaints this time
Playback works, and the segments are definitely encrypted
Testing with a single bitrate specified
I'm happy with that, will commit and push the changes.
Need to update the README to reference the encryption flag before closing this issue though
2017-04-26 22:04:51
Webhook User-Agent
View Commit
2017-04-26 22:08:17
2017-04-26 22:08:51
Webhook User-Agent
View Commit
2017-04-26 22:14:08
Marking as fixed as all my tests have passed. Will re-open if the users report they're still have issues
2017-04-26 22:14:08
2017-04-26 22:14:08
2017-04-26 22:14:13
2017-04-26 22:19:37
2017-04-26 22:19:37
2017-04-26 22:19:56
2017-04-26 22:20:00
2017-04-26 22:20:00
2017-04-26 22:20:04
2017-04-29 11:44:51
Webhook User-Agent
View Commit