This mpegtscrypto
GStreamer plugin supports MPEG-TS stream encryption and decryption using various algorithms, such as CSA/CSA3 (via libcsa
) and AES/DES/TDES (via OpenSSL
). The plugin provides two elements, mpegtsencrypt
and mpegtsdecrypt
, which handle encryption and decryption of MPEG-TS streams.
libcsa
for CSA.Make sure you have the following dependencies installed:
sudo apt update
sudo apt install gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-tools \
libssl-dev libdvbcsa-dev meson ninja-build cmake pkg-config
sudo dnf install gstreamer1 gstreamer1-plugins-base openssl-devel \
libdvbcsa-devel meson ninja-build cmake pkg-config
If libcsa is not available in your distribution’s package manager, download and compile it from source.
meson build
ninja -C build
sudo ninja -C build install
Alternatively, install it locally:
meson build --prefix=$HOME/.local
ninja -C build install
export GST_PLUGIN_PATH=$HOME/.local/lib/gstreamer-1.0:$GST_PLUGIN_PATH
Check that the plugin has been registered with GStreamer:
gst-inspect-1.0 mpegtscrypto
You should see the plugin details and information about the mpegtsencrypt
and mpegtsdecrypt
elements.
Example output:
Factory Details:
Rank none (0)
Long-name MPEG-TS Crypto Plugin
Klass Codec/Parser
Description Plugin for encrypting/decrypting MPEG-TS streams
Author ketulabs <deji.aribuki@gmail.com>
Plugin Details:
Name mpegtscrypto
Description MPEG-TS Encryption/Decryption plugin
Filename /usr/lib/gstreamer-1.0/libgstmpegtscrypto.so
Version 1.0
License LGPL
Source module gstmpegtscrypto
Binary package GStreamer Custom
Origin URL https://github.com/deji-aribuki/gst-mpegtscrypto
mpegtsdecrypt: MPEG-TS Crypto
mpegtsencrypt: MPEG-TS Crypto
2 features:
+-- 2 elements
Here’s how to use the plugin for encryption and decryption in GStreamer pipelines.
gst-launch-1.0 filesrc location=input.ts ! tsdemux ! mpegtsencrypt algo=aes-128-cbc key=00112233445566778899aabbccddeeff ! filesink location=encrypted.ts
algo
: Algorithm for encryption (e.g., aes-128-cbc
, des-cbc
).key
: Encryption key in hexadecimal format (e.g., 00112233445566778899aabbccddeeff
).gst-launch-1.0 filesrc location=encrypted.ts ! tsdemux ! mpegtsdecrypt algo=aes-128-cbc key=00112233445566778899aabbccddeeff ! filesink location=decrypted.ts
gst-launch-1.0 filesrc location=input.ts ! tsdemux ! mpegtsencrypt algo=csa key=0011223344556677 ! filesink location=encrypted.ts
gst-launch-1.0 filesrc location=encrypted.ts ! tsdemux ! mpegtsdecrypt algo=csa key=0011223344556677 ! filesink location=decrypted.ts
You can enable detailed GStreamer debugging:
GST_DEBUG=mpegtscrypto:5 gst-launch-1.0 ...
This will output detailed logs for debugging the plugin.
The mpegtscrypto
plugin is released under the LGPL license.
aes-128-ecb aes-128-cbc-rsb aes-128-cbc-scte aes-128-cbc-cs aes-128-ctr aes-128-ctr64 aes-256-ecb aes-256-cbc-rsb aes-256-cbc-scte aes-256-cbc-cs aes-256-ctr aes-256-ctr64 des-ecb des-cbc-rsb des-cbc-scte tdes-ecb tdes-ecb-cs tdes-cbc-rsb tdes-cbc-scte dvb-csa dvb-csa3.