Skip to main content

Sanzan

PyPI Release PyPI Version

Sanzan is a simple encryption library to encrypt and decrypt videos while maintaining playability.

It uses NumPy and OpenCV to perform video frame manipulation, while using FFmpeg and Pydub for audio manipulation. Sanzan can be used either from the command line or in a Python program.

Encrypted Video

Encrypted

Decrypted Video:

Decrypted

Installation

Prerequisite

FFmpeg must be installed and in PATH.

pip install sanzan

Usage

Encryption

sz original.mp4 -k <key> -e -o encrypted.mp4 

On a stream

sz https://youtu.be/dQw4w9WgXcQ -k <key> -e -o encrypted.mp4 

Decryption

sz encrypted.mp4 -k <key> -d -o decrypted.mp4 

With preview

sz encrypted.mp4 -k <key> -d -o decrypted.mp4 -p
  • Frames will be displayed as quickly as they are generated.
  • Audio will only start playing after the whole stream has been processed.

More Usage

Omit the -k argument to encrypt using randomly generated keyfiles.

Use the -m argument to specify mode: audio, video or full (default).

Use the -q flag for quiet mode.

Audio options

Use the -a argument to specify output audio format: mp3, wav (default), flac, etc.

Use the -l flag to use light encryption/decryption.

Use the -dn flag to apply denoising to the output audio.

Use the -pp flag to disable audio padding.

Video options

Use the -s argument to specify scramble method: rows (default), cols, full.

Use the -f flag to generate a different scramble order every frame.

Python Usage

Alternatively, Sanzan provides a Python interface to programmatically access its functionality.

Encryption

from sanzan import Sanzan

if __name__ == "__main__":
    s = Sanzan("original.mp4")
    s.set_password("1234")
    s.encrypt("encrypted.mp4")

Decryption

from sanzan import Sanzan

if __name__ == "__main__":
    s = Sanzan("encrypted.mp4")
    s.set_password("1234")
    s.decrypt("decrypted.mp4", preview=True, denoise=True)

Release files for Sanzan 2.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Sanzan 2.0.5
File Size Uploaded
Sanzan-2.0.5.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Sanzan 2.0.5
File Interpreter ABI Platform
Sanzan-2.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / Sanzan-2.0.5.tar.gz

Download URL Sanzan-2.0.5.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c4078c4c6351941a95db9cc409aff8b598b4c8326e60b31de42fdab0f6c8fcd1
BLAKE2b-256 checksum
How to use checksums
a5b53ba4e629ddb2b03ade0443a1ba33f4235a02e60fdc543a977d2ed8331d37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / Sanzan-2.0.5-py3-none-any.whl

Download URL Sanzan-2.0.5-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5431bac9fa46a6d3f151ed28e60f42f27511df3655d8842de2a93e65d7e36474
BLAKE2b-256 checksum
How to use checksums
b62747229818c05e4c4b1743eb3b2791ad7a6e4cf8771e57ba162e80549680e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

2.0.5 This release

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.21

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page