MPEG-DASH z MPD s "cenc (AES-128 CTR)"

Jigdo

  • *****
  • 506
    • Zobrazit profil
MPEG-DASH z MPD s "cenc (AES-128 CTR)"
« kdy: 01. 01. 2021, 10:30:05 »
Dobry den/novy rok,

zkousel jsem sifrovane video a tady je co mi funguje:


Stahnul jsem mp4 sample z YT a zasifroval pomoci FFMPEG/cenc (AES-128 CTR):
youtube-dl -o '%(id)s.%(ext)s' -f best 6NE7IHRn1jA
ffmpeg -i 6NE7IHRn1jA.mp4 -vcodec copy -acodec copy -encryption_scheme cenc-aes-ctr -encryption_key 100b6c20940f779a4589152b57d2dacb -encryption_kid eb676abbcb345e96bbcf616630f1a3da 6NE7IHRn1jA_encrypted.mp4

kontrola v Bento4 aplikaci (~/Bento4-SDK-1-6-0-637.x86_64-unknown-linux/bin$) se sifrovani zobrazuje:
./mp4info --verbose 6NE7IHRn1jA_encrypted.mp4
Kód: [Vybrat]
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: avc1
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   20063 ms
  time scale: 1000
  fragments:  no

Found 2 Tracks
Track 1:
  flags:        3 ENABLED IN-MOVIE
  id:           1
  type:         Video
  duration: 20000 ms
  language: und
  media:
    sample count: 500
    timescale:    12800
    duration:     256000 (media timescale units)
    duration:     20000 (ms)
    bitrate (computed): 3076.912 Kbps
  display width:  1920.000000
  display height: 1080.000000
  frame rate (computed): 25.000
  Sample Description 0
    [ENCRYPTED]
      Coding:         encv
      Scheme Type:    cenc
      Scheme Version: 65536
      Scheme URI:     
    Protection System Details:
    [schi] size=8+32
      [tenc] size=12+20
        default_isProtected = 1
        default_Per_Sample_IV_Size = 8
        default_KID = [eb 67 6a bb cb 34 5e 96 bb cf 61 66 30 f1 a3 da]
    Bytes: 00000000000000010000000000000000000000000000000007800438004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018ffff000000356176634301640028ffe1001e67640028acd100780227e5c05a808080a0000003002000000641e306224001000468eb8f2c000000107061737000000001000000010000005073696e660000000c66726d6161766331000000147363686d0000000063656e630001000000000028736368690000002074656e630000000000000108eb676abbcb345e96bbcf616630f1a3da
    Coding:      avc1 (H.264)
    Width:       1920
    Height:      1080
    Depth:       24
    AVC Profile:          100 (High)
    AVC Profile Compat:   0
    AVC Level:            40
    AVC NALU Length Size: 4
    AVC SPS: [67640028acd100780227e5c05a808080a0000003002000000641e3062240]
    AVC PPS: [68eb8f2c]
    Codecs String: avc1.640028
Track 2:
  flags:        3 ENABLED IN-MOVIE
  id:           2
  type:         Audio
  duration: 20063 ms
  language: eng
  media:
    sample count: 864
    timescale:    44100
    duration:     884736 (media timescale units)
    duration:     20062 (ms)
    bitrate (computed): 128.000 Kbps
  Sample Description 0
    [ENCRYPTED]
      Coding:         enca
      Scheme Type:    cenc
      Scheme Version: 65536
      Scheme URI:     
    Protection System Details:
    [schi] size=8+32
      [tenc] size=12+20
        default_isProtected = 1
        default_Per_Sample_IV_Size = 8
        default_KID = [eb 67 6a bb cb 34 5e 96 bb cf 61 66 30 f1 a3 da]
    Bytes: 000000000000000100000000000000000002001000000000ac4400000000003565736473000000000327000000041f40150000000001f3ff0001f3ff051012100000000000000000000000000000060102
    Coding:      mp4a (MPEG-4 Audio)
    Stream Type: Audio
    Object Type: MPEG-4 Audio
    Max Bitrate: 127999
    Avg Bitrate: 127999
    Buffer Size: 0
    Codecs String: mp4a.40.2
    MPEG-4 Audio Object Type: 2 (AAC Low Complexity)
    MPEG-4 Audio Decoder Config:
      Sampling Frequency: 44100
      Channels: 2
    Sample Rate: 44100
    Sample Size: 16
    Channels:    2


Pote prehravani ve ffplay/mpv funguje s sifrovacim klicem jak ma .. (cvlc/vlc ne)
ffplay 6NE7IHRn1jA_encrypted.mp4 -decryption_key 100b6c20940f779a4589152b57d2dacb
mpv --demuxer-lavf-o=decryption_key=100b6c20940f779a4589152b57d2dacb 6NE7IHRn1jA_encrypted.mp4
ve c/vlc se mi nepodarilo zjistit jak dekodovat sifrovane video.... :( (asi to jeste neumi, nikde jsem to v documentaci nenasel)




Ale co nefunguje je dekodovani 128-bit klice v hex pomoci aplikace mp4decrypt/Bento4:
./mp4decrypt --key 1:100b6c20940f779a4589152b57d2dacb --key 2:100b6c20940f779a4589152b57d2dacb --show-progress 6NE7IHRn1jA_encrypted.mp4 decrypted_6NE7IHRn1jA_encrypted2.mp4

ani s KID/klice v hex
./mp4decrypt --key eb676abbcb345e96bbcf616630f1a3da:100b6c20940f779a4589152b57d2dacb --key eb676abbcb345e96bbcf616630f1a3da:100b6c20940f779a4589152b57d2dacb --show-progress 6NE7IHRn1jA_encrypted.mp4 decrypted_6NE7IHRn1jA_encrypted.mp4

Nevi nekdo proc, kde delam chybu?









Dale jsem zkousel stahnout sample sifovaneho videa ze stranek: https://bitmovin.com/demos/drm
Jedna se o MPEG-DASH umistene tady: https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd
ale nedari se mi z MPD manifestu stahnout video/audio korektne.

Pro jednoduchost se snazim stahnout jen audio stopu, ktera ma tyhle parametry podle MPD manifestu (Widevine:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED|cenc|KID=eb676abbcb345e96bbcf616630f1a3da)
Kód: [Vybrat]
            <Representation id="1_stereo_192000" bandwidth="192000" audioSamplingRate="48000">
                <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="eb676abb-cb34-5e96-bbcf-616630f1a3da" xmlns:cenc="urn:mpeg:cenc:2013"/>
                <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
                    <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">AAAAW3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3IzaioCSEQyAA==</cenc:pssh>
                </ContentProtection>


Ale audio stopa vubec nema zaden zaznam o nejakem sifrovani ... a neda se pochopitelne desifrovat ....
ffmpeg -i https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd -map 0:6 -codec copy 11331_06.mp4
./mp4info --verbose 11331_06.mp4
ffplay 11331_06.mp4 -decryption_key 100b6c20940f779a4589152b57d2dacb
mpv --demuxer-lavf-o=decryption_key=100b6c20940f779a4589152b57d2dacb 11331_06.mp4
Kód: [Vybrat]
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   210304 ms
  time scale: 1000
  fragments:  no

Found 1 Tracks
Track 1:
  flags:        3 ENABLED IN-MOVIE
  id:           1
  type:         Audio
  duration: 210304 ms
  language: und
  media:
    sample count: 9859
    timescale:    48000
    duration:     10094592 (media timescale units)
    duration:     210304 (ms)
    bitrate (computed): 189.394 Kbps
  Sample Description 0
    Bytes: 000000000000000100000000000000000002001000000000bb8000000000002765736473000000000319000000041140150000000002e6840002e3d205021190060102
    Coding:      mp4a (MPEG-4 Audio)
    Stream Type: Audio
    Object Type: MPEG-4 Audio
    Max Bitrate: 190084
    Avg Bitrate: 189394
    Buffer Size: 0
    Codecs String: mp4a.40.2
    MPEG-4 Audio Object Type: 2 (AAC Low Complexity)
    MPEG-4 Audio Decoder Config:
      Sampling Frequency: 48000
      Channels: 2
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2


Jak se da stahnout korektne tato audio stopa? Kde delam chybu?