Skip to content

Instantly share code, notes, and snippets.

@jordicenzano
Created October 29, 2017 03:21
Show Gist options
  • Save jordicenzano/83ba13619b4837e2d217f42639e16708 to your computer and use it in GitHub Desktop.
Save jordicenzano/83ba13619b4837e2d217f42639e16708 to your computer and use it in GitHub Desktop.
Bash script that generates an HLS encrypted (AES128 chunk) from MP4
#Generate HLS chunklist with AES128 chunk encryption file
#Source data
SOURCE="/Users/jcenzano/Movies/test10m_baseline_30_320x240_a25fpsB.mp4"
#Dest data
DEST="/Users/jcenzano/Movies/hls-encrypted/result-aes128"
KEYS_DIR="keys"
DEST_KEYS=$DEST"/"$KEYS_DIR
#Ensure dest directories exists
mkdir -p $DEST_KEYS
#Keys URL in the index file
BASE_KEYS_URL="/$KEYS_DIR"
#Generate SIMPLE AES128 chunk encryption
mediafilesegmenter -file-base "$DEST" -encrypt-key-file "$DEST_KEYS" -encrypt-key-url "$BASE_KEYS_URL" $SOURCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment