Skip to content

Instantly share code, notes, and snippets.

@kevinGodell
Created August 2, 2020 00:34
Show Gist options
  • Save kevinGodell/3ce8ca80315a2e20c75b7d78361df6a0 to your computer and use it in GitHub Desktop.
Save kevinGodell/3ce8ca80315a2e20c75b7d78361df6a0 to your computer and use it in GitHub Desktop.
testing ffmpeg mp4 encryption
#!/bin/bash
# convert, encrypt, decrypt, probe
echo "Hello ffmpeg mp4 encryption!"
echo -e "\n---------- convert wav to mp4 ----------\n"
ffmpeg -y -i long_input_44100.wav long_input_44100.mp4
echo -e "\n---------- encrypt mp4 ----------\n"
ffmpeg -y -i long_input_44100.mp4 -encryption_scheme cenc-aes-ctr -encryption_key 76a6c65c5ea762046bd749a2e632ccbb -encryption_kid a7e61c373e219033c21091fa607bf3b8 long_input_44100_encrypted.mp4
echo -e "\n---------- decrypt mp4 ----------\n"
ffmpeg -y -decryption_key 76a6c65c5ea762046bd749a2e632ccbb -i long_input_44100_encrypted.mp4 long_input_44100_decrypted.mp4
echo -e "\n---------- encrypt hls mpegts ----------\n"
ffmpeg -y -i long_input_44100.mp4 -f hls -hls_segment_type mpegts -hls_enc 1 -hls_enc_key 76a6c65c5ea762046bd749a2e632ccbb mpegts.m3u8
echo -e "\n---------- encrypt hls fmp4 ----------\n"
ffmpeg -y -i long_input_44100.mp4 -f hls -hls_segment_type fmp4 -hls_enc 1 -hls_enc_key 76a6c65c5ea762046bd749a2e632ccbb fmp4.m3u8
echo -e "\n---------- probe encrypted mp4 ----------\n"
ffprobe -decryption_key 76a6c65c5ea762046bd749a2e632ccbb -i long_input_44100_encrypted.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment