Last active
June 18, 2021 16:55
-
-
Save m-rey/3d64b393936fb64360052ee7ee8c61d6 to your computer and use it in GitHub Desktop.
Small script to decrypt encrypted videos of https://gitlab.com/tnibler/cryptocam that replaces https://gitlab.com/tnibler/cryptocam-companion License: GPL-3.0-only: https://www.gnu.org/licenses/gpl-3.0-standalone.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2021 Martin Rey | |
# REQUIREMENTS | |
# bash, xargs, gpg2, ffmpeg, jq | |
# | |
# USAGE | |
# cryptocam_decrypt.sh INPUT_DIR OUTPUT_DIR | |
# | |
# NOTE | |
# `pwd` is the default if a directory isn't set | |
shopt -s nullglob | |
# only add slash to directry path if a path is set | |
test -z "${1}" || INPUT_DIR=$(realpath "${1}")/ | |
test -z "${2}" || OUTPUT_DIR=$(realpath "${2}")/ | |
# go through every encrypted metadata file, read its content | |
# and use it to decrypt the corresponding, encrypted media file | |
for encrypted_file in "${INPUT_DIR}"*.pgp; do | |
gpg -q --decrypt "${encrypted_file}" | jq -r ".timestamp, .encryptionKey" | xargs sh -c "ffmpeg -decryption_key \$1 -i ${encrypted_file%%.*}.mp4 ${OUTPUT_DIR}/\$0.mp4" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This in incompatible with the cryptocam versions >=2.0.0 !
Upstream has revamped basically every part of the project with the release of version 2. They've also switched to
age
for encrypting, among other things. That's one of the main reasons why this won't work anymore on videos captured with cryptocam 2.x.xLuckily, they now also provide both a GUI and a CLI tool to decrypt the videos!
Take a look at https://gitlab.com/cryptocam/cryptocam-companion-cli (CLI) and https://gitlab.com/cryptocam/cryptocam-companion (GUI) if interested.
There's also a dedicated website over at https://cryptocam.gitlab.io/ with step by step guides, feature showcases and documentation.