kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
2k stars 439 forks source link

WIDEVINE DASH ABR PLAYBACK #1321

Open nkkrishna opened 2 years ago

nkkrishna commented 2 years ago

Is it possible to apply different DRM encryptionKey(s) for different bitrates like [apply SD key for 240p, 360p profiles and apply HD Key for 1080p profile]. I have configured different encryptionKey(s) in my adaptive set json file (test.json). But i have mentioned only one pssh, key and key_id in the DRM Server response json (1123456711.json). Not sure if different encrytion keys are being used for different bitrates?

`location /media/ { root /test1/vod_test/;

                    vod dash;
                    vod_segment_duration 4000;
                    vod_manifest_duration_policy min;
                    vod_align_segments_to_key_frames on;
                    vod_dash_manifest_format segmenttemplate;
                    vod_dash_profiles urn:mpeg:dash:profile:isoff-live:2011;
                    vod_max_mapping_response_size 64k;
                    vod_upstream_location "";

                    vod_drm_upstream_location /drmdashinfo;
                    vod_drm_enabled on;
                    vod_drm_request_uri "";

                    vod_last_modified_types *;
                    add_header Access-Control-Allow-Headers '*';
                    add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
                    add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
                    add_header Access-Control-Allow-Origin '*';
                    expires -1;
            }

    location /drmdashinfo {

                    internal;
                    proxy_pass "http://127.0.0.1/drmdashfile/1123456711.json";
                    }

    location / {
            root /test1/vod_test/;
            }

` _cat drmdashfile/1123456711.json [{ "pssh": [{ "data": "IgURABCDEUjj3JWbBg==", "uuid": "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" }], "key": "K8zlrt4YvMSoJ+8gg6ToVw==", "key_id": "xgeDM/5iX+ClQcFTqUo62w==" }]

cat test.json { "sequences": [ { "clips": [ { "type": "source", "path": "test_240.mp4", "encryptionKey": "K8zlrt4YvMSoJ+8gg6ToVw==" } ] }, { "clips": [ { "type": "source", "path": "test_360.mp4", "encryptionKey": "K8zlrt4YvMSoJ+8gg6ToVw==" } ] }, { "clips": [ { "type": "source", "path": "test2492.mp4", "encryptionKey": "cvb8n040gzOl505URjpFKw==" } ] } ] }

erankor commented 2 years ago

The module calls the DRM server for each sequence in the set. In this case, you've set vod_drm_request_uri to an empty string, so all these requests end up identical. If you will remove this directive, you'll get the original URI on the DRM request, and you could use that to return different keys. That said, we had issues in the past when using multiple keys in a single playback set, not sure if the issues were in Widevine or PlayReady, but anyway, we don't currently do it - a single key per set.