Using openssl encryption for Apple's HTTP Live Streaming

后端 未结 4 886
夕颜
夕颜 2021-02-02 18:12

Has anyone had any luck getting encrypted streaming to work with Apple\'s HTTP Live Streaming using openssl? It seems I\'m almost there but my video doesn\'t play but I don\'t g

4条回答
  •  孤城傲影
    2021-02-02 18:54

    Also keep in mind the following, if you have more than 1 TS "chunk", and you're looking for a bit-exact replacement for the Apple encryption pipeline. By default, the Apple encryption tool updates the IV (initialization vector) parameter for each of the chunks, which "increases the strength of the cipher," according to the Pantos spec.

    Implementing this just means that the sequence number needs to be encoded in hex and passed as the -iv parameter to openssl:

    #!/bin/bash
    keyFile="key.txt"
    openssl rand 16 > $keyFile
    hexKey=$(cat key.txt | hexdump -e '"%x"')
    # hexIV='0'
    for i in {0..number_of_TS_chunks}
    do
        hexIV=`printf '%032x' $i`
        openssl aes-128-cbc -e -in $fileName -out $encryptedFileName -p -nosalt -iv ${hexIV} -K ${hexKey}
    done
    

提交回复
热议问题