Closed Able1991 closed 7 months ago
This affects me too. I add that the chunks are properly encrypted, but the medialists don't include the EXT-X-KEY tag.
@joeyparrish @cosmin I can see you guys are working hard to release v3.0, but this issue seems to have passed unnoticed and it's serious: it makes Fairplay (which means all of Apple ecosystem) unplayable.
Encryption seems to be working fine, but somehow the EXT-X-KEY
syntax is missing on the output HLS medialists. So it should be a side effect of some other change in the HLS medialists code. I could take a look at it myself, but not until next week. If you guys need to release v3.0 faster than that, please consider take a look at this issue, as it shouldn't be any major work (just some missing string) but the damage is serious: v3 without this fixed would be unusable for many of us.
@Canta, was this fixed by https://github.com/shaka-project/shaka-packager/pull/1011, which we merged the same day you commented?
@joeyparrish I've finally tested it a minute ago with a fresh build, and I'm afraid the problem persists. Here's my packager command, with redacted DRM data because it's production data:
packager \
--segment_duration=6.4 \
--time_shift_buffer_depth=10 \
--preserved_segments_outside_live_window=10 \
--default_language=spa \
--suggested_presentation_delay=0 \
--min_buffer_time=12.8 \
--minimum_update_period=12.8 \
--io_cache_size=10000000 \
--mp4_include_pssh_in_stream=false \
--allow_approximate_segment_timeline \
--transport_stream_timestamp_offset_ms 250 \
--segment_template_constant_duration \
--hls_master_playlist_output=/run/packager/testsignal2/master.m3u8 \
--hls_playlist_type LIVE \
--enable_raw_key_encryption \
--mp4_include_pssh_in_stream=false \
--keys label=HD:key_id=00000000000000000000000000000000:key=00000000000000000000000000000000,label=SD:key_id=00000000000000000000000000000000:key=00000000000000000000000000000000,label=AUDIO:key_id=00000000000000000000000000000000:key=00000000000000000000000000000000 \
--protection_scheme cbcs \
--pssh 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
--iv 00000000000000000000000000000000 \
--hls_key_uri skd://redacted_url \
in=udp://127.0.0.1:20022,stream_selector=0,init_segment=/run/packager/testsignal2/360x240_hls_init.m4s,segment_template=/run/packager/testsignal2/360x240_hls_$Time%09d$.m4s,drm_label=SD,playlist_name=360x240.m3u8,bandwidth=5000000 \
in=udp://127.0.0.1:20022,stream_selector=1,init_segment=/run/packager/testsignal2/audiospa_hls_init.m4s,segment_template=/run/packager/testsignal2/audiospa_hls_$Time%09d$.m4s,drm_label=SD,playlist_name=audiospa.m3u8,hls_name=spa,bandwidth=64000,language=spa
The output m3u8 medialist doesn't have an EXT-X-KEY
tag.
Thanks for the confirmation! We'll look into it.
I have some extra data. I've run the same command from my last comment, but using @Able1991 DRM data, and the output do have EXT-X-KEY
tag.
Here's the command:
packager \
--segment_duration=6.4 \
--time_shift_buffer_depth=10 \
--preserved_segments_outside_live_window=10 \
--default_language=spa \
--suggested_presentation_delay=0 \
--min_buffer_time=12.8 \
--minimum_update_period=12.8 \
--io_cache_size=10000000 \
--mp4_include_pssh_in_stream=false \
--allow_approximate_segment_timeline \
--transport_stream_timestamp_offset_ms 250 \
--segment_template_constant_duration \
--hls_master_playlist_output=/run/packager/testsignal2/master.m3u8 \
--hls_playlist_type LIVE \
--enable_raw_key_encryption \
--mp4_include_pssh_in_stream=false \
--keys label=HD:key_id=6be5fde68dfe078c0fe5b7cd4ba0295f:key=0738005ffe55a949da01982e35e5e380,label=SD:key_id=6be5fde68dfe078c0fe5b7cd4ba0295f:key=0738005ffe55a949da01982e35e5e380,label=AUDIO:key_id=6be5fde68dfe078c0fe5b7cd4ba0295f:key=0738005ffe55a949da01982e35e5e380 \
--protection_scheme cbcs \
--pssh 000002ba70737368000000009a04f07998404286ab92e65be0885f950000029a9a0200000100010090023c00570052004d00480045004100440045005200200078006d006c006e0073003d00220068007400740070003a002f002f0073006300680065006d00610073002e006d006900630072006f0073006f00660074002e0063006f006d002f00440052004d002f0032003000300037002f00300033002f0050006c00610079005200650061006400790048006500610064006500720022002000760065007200730069006f006e003d00220034002e0030002e0030002e00300022003e003c0044004100540041003e003c00500052004f00540045004300540049004e0046004f003e003c004b00450059004c0045004e003e00310036003c002f004b00450059004c0045004e003e003c0041004c004700490044003e004100450053004300540052003c002f0041004c004700490044003e003c002f00500052004f00540045004300540049004e0046004f003e003c004b00490044003e003500760033006c0061002f0036004e006a004100630050003500620066004e005300360041007000580077003d003d003c002f004b00490044003e003c0043004800450043004b00530055004d003e00690074004b002f003800320077004e003200720030003d003c002f0043004800450043004b00530055004d003e003c004c0041005f00550052004c003e00680074007400700073003a002f002f00640072006d00320035003500340032002e006d002e00640072006d006e006f0077002e00720075002f0070006c0061007900720065006100640079002f007200690067006800740073006d0061006e0061006700650072002e00610073006d0078003c002f004c0041005f00550052004c003e003c002f0044004100540041003e003c002f00570052004d004800450041004400450052003e00 \
--iv 00000000000000000000000000000000 \
--hls_key_uri skd://redacted_url \
in=udp://127.0.0.1:20022,stream_selector=0,init_segment=/run/packager/testsignal2/360x240_hls_init.m4s,segment_template=/run/packager/testsignal2/360x240_hls_\$Time%09d\$.m4s,drm_label=SD,playlist_name=360x240.m3u8,bandwidth=5000000 \
in=udp://127.0.0.1:20022,stream_selector=1,init_segment=/run/packager/testsignal2/audiospa_hls_init.m4s,segment_template=/run/packager/testsignal2/audiospa_hls_\$Time%09d\$.m4s,drm_label=SD,playlist_name=audiospa.m3u8,hls_name=spa,bandwidth=64000,language=spa
And here's the output medialist:
# cat /run/packager/testsignal2/360x240.m3u8
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/shaka-project/shaka-packager version 9be7c2b-release
#EXT-X-TARGETDURATION:7
#EXT-X-MAP:URI="360x240_hls_init.m4s"
#EXTINF:5.600,
360x240_hls_2849008056.m4s
#EXT-X-DISCONTINUITY
#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;charset=UTF-16;base64,mgIAAAEAAQCQAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4ANQB2ADMAbABhAC8ANgBOAGoAQQBjAFAANQBiAGYATgBTADYAQQBwAFgAdwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBpAHQASwAvADgAMgB3AE4AMgByADAAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBkAHIAbQAyADUANQA0ADIALgBtAC4AZAByAG0AbgBvAHcALgByAHUALwBwAGwAYQB5AHIAZQBhAGQAeQAvAHIAaQBnAGgAdABzAG0AYQBuAGEAZwBlAHIALgBhAHMAbQB4ADwALwBMAEEAXwBVAFIATAA+ADwALwBEAEEAVABBAD4APAAvAFcAUgBNAEgARQBBAEQARQBSAD4A",IV=0x00000000000000000000000000000000,KEYFORMATVERSIONS="1",KEYFORMAT="com.microsoft.playready"
#EXTINF:6.400,
360x240_hls_2849512056.m4s
#EXTINF:6.400,
360x240_hls_2850088056.m4s
The key and keyids are all the same, repeated for each DRM label. I suspect the problem may be related to my pssh string. This is the data from @Able1991 PSSH:
pssh-box.py --from-hex 000002ba70737368000000009a04f07998404286ab92e65be0885f950000029a9a0200000100010090023c00570052004d00480045004100440045005200200078006d006c006e0073003d00220068007400740070003a002f002f0073006300680065006d00610073002e006d006900630072006f0073006f00660074002e0063006f006d002f00440052004d002f0032003000300037002f00300033002f0050006c00610079005200650061006400790048006500610064006500720022002000760065007200730069006f006e003d00220034002e0030002e0030002e00300022003e003c0044004100540041003e003c00500052004f00540045004300540049004e0046004f003e003c004b00450059004c0045004e003e00310036003c002f004b00450059004c0045004e003e003c0041004c004700490044003e004100450053004300540052003c002f0041004c004700490044003e003c002f00500052004f00540045004300540049004e0046004f003e003c004b00490044003e003500760033006c0061002f0036004e006a004100630050003500620066004e005300360041007000580077003d003d003c002f004b00490044003e003c0043004800450043004b00530055004d003e00690074004b002f003800320077004e003200720030003d003c002f0043004800450043004b00530055004d003e003c004c0041005f00550052004c003e00680074007400700073003a002f002f00640072006d00320035003500340032002e006d002e00640072006d006e006f0077002e00720075002f0070006c0061007900720065006100640079002f007200690067006800740073006d0061006e0061006700650072002e00610073006d0078003c002f004c0041005f00550052004c003e003c002f0044004100540041003e003c002f00570052004d004800450041004400450052003e00
PSSH Box v0
System ID: PlayReady 9a04f079-9840-4286-ab92-e65be0885f95
PSSH Data (size: 666):
PlayReady Data:
Record (size 656):
Record Type: Rights Management Header (1)
Record XML:
<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0"><DATA><PROTECTINFO><KEYLEN>16</KEYLEN><ALGID>AESCTR</ALGID></PROTECTINFO><KID>5v3la/6NjAcP5bfNS6ApXw==</KID><CHECKSUM>itK/82wN2r0=</CHECKSUM><LA_URL>https://drm25542.m.drmnow.ru/playready/rightsmanager.asmx</LA_URL></DATA></WRMHEADER>
And here's mine:
pssh-box.py --from-hex 00000054707373680100000029701FE43CC74A348C5BAE90C7439A47000000038A69D922542950B487D9779CEC940712A4C4AD4605405A378E4FFAC5489B93AEBEB28005E90758008F9BC3F17C918FF500000000
PSSH Box v1
System ID: 29701fe4-3cc7-4a34-8c5b-ae90c7439a47
Key IDs (3):
8a69d922-5429-50b4-87d9-779cec940712
a4c4ad46-0540-5a37-8e4f-fac5489b93ae
beb28005-e907-5800-8f9b-c3f17c918ff5
PSSH Data (size: 0):
This is the output medialist I get with my own PSSH:
# cat /run/packager/testsignal2/360x240.m3u8
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/shaka-project/shaka-packager version 9be7c2b-release
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:267053463
#EXT-X-DISCONTINUITY-SEQUENCE:1
#EXT-X-MAP:URI="360x240_hls_init.m4s"
#EXTINF:6.400,
360x240_hls_2846056056.m4s
#EXTINF:6.400,
360x240_hls_2846632056.m4s
#EXTINF:6.400,
360x240_hls_2847208056.m4s
So, I believe this issue, which tells about a PlayReady related problem, was most likely solved in #1011 or some other commit. But I came to this ticket because of the absence of EXT-X-KEY
tag while using FairPlay, and not in the context of PlayReady. It seems PlayReady may have been a particular case of another more general problem.
I guess it could be System ID
related somehow?
Ah, that makes sense. So @Able1991's PlayReady problem (this ticket) is resolved, and @Canta's FairPlay problem isn't. @Canta, can you file a separate ticket for clarity so we can resolve this one?
System info
Shaka Packager Version: v2.6.1-634af65-release
Issue and steps to reproduce the problem
When packaging hls with protection_scheme cbcs and playready pssh, the #EXT-X-KEY tag is not added. cbcs is used for the combination widevine + playready + fairplay. Tags for widevine and fairplay correctly if i add pssh for these systems
Packager Command:
What is the expected result? Expect #EXT-X-KEY tag in result manifest What happens instead? Tag missing