TSDECRYPT(1)
๐ tsdecrypt(1) ๐
okay bestie, welcome to the tsdecrypt(1) manual page from the User Commands section. this is the one where we decrypt an mpeg transport stream, and I'm gonna walk you through every single flag like we're texting in the group chat. no cap. ๐ซถ
โจ NAME โจ
tsdecrypt โ Decrypt mpeg transport stream.
๐ฆ SYNOPSIS ๐ฆ
tsdecrypt [options]
๐ธ DESCRIPTION ๐ธ
okay so tsdecrypt reads an incoming mpeg transport stream over UDP/RTP or from a file, and then it decrypts it after retrieving code words from OSCAM or a similar CAMD server. it talks to the CAM server using the cs378x protocol (that's camd35 over tcp) or the newcamd protocol. literally the whole vibe. ๐
๐ OPTIONS ๐
๐ MAIN OPTIONS ๐
-i,--ident <ident>โ set the ident that gets used when logging to syslog. the preferred format for the ident isPROVIDER/CHANNEL.-d,--daemon <pidfile>โ when started, become a daemon and write the pid file to<pidfile>.-N,--notify-program <program>โ execute<program>when predefined events happen. for this option to work,--identshould also be used. you can use thenotify-script.examplefile as a notification program and as an example of how to create your own notification script. see the EVENTS section for a detailed description of the events.-S,--syslogโ write log messages to local syslog.-l,--syslog-host <addr>โ set the syslog host.tsdecryptsends messages to this host over tcp in syslog compatible format. syslog-ng was tested as a receiving syslog server.-L,--syslog-port <port>โ syslog server port. the default value is514.-F,--log-file <filename>โ write logging data to<filename>. this option can be used along with syslog.-D,--debug <level>โ set the message debug level. currently there are five message levels.0= default messages,1= show PSI tables,2= show EMMs,3= show duplicate ECMs,4= packet debug,5= packet debug + mpeg ts packet dump. setting a higher level enables the levels below.-j,--pid-reportโ when this option is used,tsdecrypton exit reports how much packets were received on each PID.-b,--benchโ benchmark the CSA decryption. the benchmark is single threaded. if you want to fully test your CPU, run a couple oftsdecrypts in parallel.-V,--versionโ show program version.-h,--helpโ show program help.
๐ฐ๏ธ INPUT OPTIONS ๐ฐ๏ธ
-I,--input <source>โ where to read from.tsdecryptsupports input from file (-I file://file.ts), IPv4 multicast/unicast addresses (-I 224.0.0.1:5000) or IPv6 multicast/unicast addresses (-I [ff01::1111]:5000). by defaulttsdecryptreads from stdin.-1,--input-source <ipaddr>โ set multicast input source address usingIP_ADD_SOURCE_MEMBERSHIP. this works only for IPv4 multicast. the default value is0.0.0.0(do not apply source filtering).-R,--input-rtpโ when reading from multicast, assume the input is an RTP stream. NOTE: no RTP processing/reordering of packets is done. the 12 byte RTP header is just stripped out and the stream is then processed as a normal mpeg transport stream over UDP multicast.-z,--input-ignore-discโ do not report input discontinuity or RTP discontinuity errors.-M,--input-service <service_id>โ choose the service id. this option must be used when the input is MPTS in order to select the correct service (program). if the input is MPTS and--input-serviceis not used,tsdecryptchooses the last service listed in PAT.-T,--input-buffer <miliseconds>โ use this option to delay the decoding for a certain amount of milliseconds. this allowstsdecryptto decode services even if OSCAM returns the code word too late. for example SkyUK sends code words ~700 ms before it starts using them. this means that if OSCAM is unable to return a code word in less than 700 ms, the decryption will fail for a small amount of time. setting--input-buffer 1000will solve the problem in this case.-W,--input-dump <filename>โ save input stream in<filename>. if the input is RTP, the file will contain the data without RTP headers (pure mpeg transport stream). the easiest way to save the input is using a command line like the following:
tsdecrypt -I 239.78.78.78:5000 -O /dev/null -s 0.0.0.0 -W file.ts
๐ค OUTPUT OPTIONS ๐ค
-O,--output <dest>โ output decrypted stream to<dest>. the destination can be an IPv4 multicast address (-O 239.0.0.1:5000), an IPv6 multicast address (-O [ff01::2222]:5000), a hostname that resolves to an IPv4/IPv6 address (-O example.com:5000) or a file. when the output is a file, the file name should be prefixed withfile://(-O file://out.ts) if it doesn't contain a/symbol. the default output is stdout.-o,--output-intf <value>โ set multicast output interface. the value can be the IPv4 address of the output interface (default:0.0.0.0/any/) or, in the case of IPv6, the interface number (default:-1/any/).-t,--output-ttlโ set multicast ttl. the default value is1.-g,--output-tosโ set TOS value of output packets. the default is not to set any specific TOS.-r,--output-rtpโ enable RTP output. the default output is standard MPEG TS over UDP; this option enablestsdecryptto output RTP packets.-k,--output-rtp-ssrc <ssrc>โ the original page just drops the flag and the<ssrc>placeholder here with no extra description, so that's exactly what we're keeping. ๐-u,--no-output-on-errorโ filter all output when there is no valid code word.-p,--no-output-filterโ disable output filtering. by default the output filter is enabled and only PAT/PMT/SDT and data packets are left in the output. everything else not mentioned in PMT, like NIT, EIT, TDT tables and unknown pids, is removed.-y,--output-nit-passโ pass through NIT packets when output filtering is enabled.-w,--output-eit-passโ pass through EIT (EPG) packets when output filtering is enabled.-x,--output-tdt-passโ pass through TDT/TOT packets when output filtering is enabled.
๐ CA OPTIONS ๐
-c,--ca-system <ca_sys>โ process input EMM/ECM from<ca_sys>. currently tested and working CA systems are CONAX, CRYPTOWORKS, IRDETO, VIACCESS, MEDIAGUARD (SECA) and VIDEOGUARD (NDS), NAGRA, BULCRYPT, GRIFFIN and DGCRYPT. another supported CA system that you can choose but that is not tested is DRECRYPT. the default<ca_sys>is CONAX. you can override the default CAS CAIDs by using the--caidparameter.-C,--caid <caid>โ directly set CAID. this is useful if you have a couple of CA streams from one CA but with different CAIDs, or a CAS that is unsupported by the--ca-systemparameter.-Y,--const-cw <code_word>โ set a constant code word to be used for decryption. the<code_word>should contain 32 hex chars. for example, usinga1a2a3a4a5a6a7a8b1b2b3b4b5b6b7b8as the parameter will set the even code word toa1a2a3a4a5a6a7a8and the odd code word tob1b2b3b4b5b6b7b8.-Q,--biss-key <biss_key>โ set the BISS key to be used for decryption. the<biss_key>should contain 12 chars (hex). for example,112233445566is a valid BISS key. if the BISS key contains 16 chars, this means that the key CRC is embedded in the key. these keys are also supported (they are the same as using a constant code word with the same code words for even and odd keys).
๐ก CAMD OPTIONS ๐ก
-A,--camd-proto <protocol>โ set CAMD server protocol. valid protocols areCS378XandNEWCAMD. if this option is not used, the default protocol isCS378X(camd35 over tcp).-s,--camd-server <hostname[:port]>โ set CAMD server address. you can use an IPv4/IPv6 address or hostname. if the port is not set, then2233is used as the default port.2233is the default port for the CS378X protocol, but for the NEWCAMD protocol you probably should choose another port number. to set a static IPv6 address, you have to put it in brackets ([]), for example:[1234::5678]:2233.-U,--camd-user <username>โ set CAMD user name. the default isuser.-P,--camd-pass <password>โ set CAMD user password. the default ispass.-B,--camd-des-key <des_key>โ set the DES key used by the NEWCAMD protocol. the default is0102030405060708091011121314.-4,--ipv4โ connect to the CAMD server using only IPv4 addresses of the server. IPv6 addresses would be ignored.-6,--ipv6โ connect to the CAMD server using only IPv6 addresses of the server. IPv4 addresses would be ignored.
๐ EMM OPTIONS ๐
-e,--emmโ enable sending EMMs to CAMD for processing. by default EMM processing is disabled and only ECMs are processed.-Z,--emm-pid <pid>โ set EMM pid manually. this option is useful for services that have a couple of EMM streams from one CA system. without this optiontsdecryptalways chooses the first stream from the chosen CA system.-E,--emm-onlyโ disable ECM processing and stream output. this option is useful if the EMM stream has a very high rate and is interfering with ECM processing. using--emm-onlyyou can run a specialtsdecryptdedicated only to keeping card entitlements up to date.-f,--emm-report-time <seconds>โ set the interval for EMM reports. the default is60seconds. set to0to disable EMM reports.-a,--emm-filter <filter_definition>โ add an EMM filter described by<filter_definition>. EMM filters are useful if you want to limit the number of EMMs that should reach your CAMD server. the basic<filter_defintion>isCommand/Settings, where the commands are:accept_all,reject_all,acceptandreject. for more information about filtering and for example filters, please read theFILTERINGfile that comes withtsdecrypt. this option can be used multiple times to define up to 16 different filters.
๐งฎ ECM OPTIONS ๐งฎ
-X,--ecm-pid <pid>โ set ECM pid manually. this option is useful for services that have a couple of ECM streams from one CA system. without this optiontsdecryptalways chooses the first stream from the chosen CA system. runtsdecryptwith--debug 2and look at CA descriptors in PMT to see what CA streams are available.-v,--ecm-onlyโ process ECMs but do not decode the input stream. this option is useful if you just want to populate your OSCAM DCW cache but do not want to waste CPU time on stream decoding.-H,--ecm-report-time <seconds>โ set the interval for ECM reports. the default is60seconds. set to0to disable ECM reports.-G,--ecm-irdeto-type <int>โ Set the index of the IRDETO ECM stream. NOTE: This option is deprecated, better use--ecm-irdeto-chid.-2,--ecm-irdeto-chid <int>โ IRDETO CA sends ECMs mixed in single stream on single PID. In order to select the correct ECM stream the so called CHID number is used. Oscam reports what CHIDs are activated in your card and tsdecrypt allows you to set the correct CHID number using this option. tsderypt reports what CHIDs are available in the incoming ECM stream. The CHID is 16-bit number (0x0000-0xffff).-K,--ecm-no-logโ Disable logging of ECMs and code words. Code word errors and stats reports are not affected by this option.-J,--cw-warn-time <seconds>โ After how much seconds to warn if valid code word was not received. The default is60seconds. Set to0to disable the warning.-q,--ecm-and-emm-onlyโ Process ECMs and EMMs but do not decode the input stream. This option combines--ecm-onlyand--emm-onlyoptions. Use it if you want to populate your OSCAM DCW cache and keep your card entitlements updated but do not want to waste CPU time on stream decoding.
โจ DEBUG OPTIONS โจ
-n,--ecm-file <file.txt>โ Read ECM from text file and send it to CAMD server for processing. This option must be used along with--caidand--input-serviceoptions.
The file should be normal text file, the format of the file is described bellow.
-m,--emm-file <file.txt>โ Read EMM from text file and send it to CAMD server for processing. This option must be used along with--caidand--input-serviceoptions.
Bellow is an example text file, lines starting with # are ignored and also 0x prefixes are ignored. Any other symbol in the file is processed as hex number. An example file might look like this:
# comment
aa bb cc dd ee
ff 01 02 03 04
# Other comment
0x05 0x06 0x07
๐ EVENTS ๐
Notification events are sent when --notify-program and --ident options are used. The event parameters are set as environmental variables before executing the external notification program. The variables are:
_TSโ Unix timestamp of the event._IDENTโ tsdecrypt ident parameter with "/" replaced by "-"._MESSAGE_IDโ Event message id (for example START, STOP, etc...)._MESSAGE_MSGโ Event message id with "_" replaced by " "._MESSAGE_TEXTโ Event message text. Human readable event message.
currently defined events are:
STARTโ tsdecrypt was started.CODE_WORD_OKโ Valid code word was received and decryption is working ok.NO_CODE_WORDโ No valid code word was received for X seconds. The decryption process have been suspended until valid code word is received.NO_EMM_RECEIVEDโ No EMM packet have been received for X seconds.INPUT_TIMEOUTโ There was no data on the input.INPUT_OKโ The data have appeared on the input.STOPโ tsdecrypt was stopped.
See notify-script.example for an example on how to create external notification program.
๐ EXAMPLES ๐
To get a quick start here are some example command lines. The default CA system is set to CONAX, you can change it using --ca-system parameter.
# Decrypt multicast stream from 239.0.50.11:5000 using 10.0.1.1:2233
# as camd server and output decrypted result to 239.78.78.78:5000
tsdecrypt --camd-server 10.0.1.1 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Same as above but enable EMM processing
tsdecrypt --emm --camd-server 10.0.1.1:2233 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Same as above but do not filter output stream thus allowing
# EIT/TOT/NIT, etc tables to passthrough
tsdecrypt --no-output-filter --emm --camd-server 10.0.1.1 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Choose program/service_id to decrypt. Useful when the input is MPTS
tsdecrypt --camd-server 10.0.1.1 --input-service 1234 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Read stream over RTP and process VIACCESS encoded channel
tsdecrypt --ca-system VIACCESS --emm --camd-server 10.0.1.1:2233 \
--input-rtp --input 239.0.50.11:5000 --output 239.78.78.78:5000
# Decrypt stream encypted with CAID 0x0963 (NDS, sky)
tsdecrypt --camd-server 10.0.1.1 --ca-system NDS --caid 0x0963 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Send only EMMs to OSCAM for CAID 0x0963 (NDS, sky)
tsdecrypt --camd-server 10.0.1.1 --emm-only --caid 0x0963 \
--input 239.0.50.11:5000 --output /dev/null
# Decrypt stream encypted with CAID 0x5581 (Bulcrypt)
tsdecrypt --camd-server 10.0.1.1 --caid 0x5581 \
--input 239.0.50.11:5000 --output 239.78.78.78:5000
# Decrypt BISS encrypted stream
tsdecrypt --biss-key 0x112233445566 --input 239.0.50.11:5000 \
--output 239.78.78.78:5000
# Decrypt file encypted with constant code word
tsdecrypt --const-cw 0x00000000000000001111111111111111 \
--input encrypted-file.ts --output file://decrypted-file.ts
# Send ECM from file
tsdecrypt --ecm-file ecm.txt --caid 0x5581 --input-service 12345 \
--camd-server example.com
# Decrypt IRDETO stream from Raduga (CHID == 0x0015)
tsdecrypt --input 239.0.50.11:5000 --output 239.78.78.78:5000 \
--camd-server example.com \
--ca-system IRDETO --caid 0x0652 --ecm-irdeto-chid 0x0015
๐ฅ SEE ALSO ๐ฅ
See the README file for more information. If you have questions, remarks, problems or you just want to contact the developer, write to:
georgi@unixsol.org
For more info, see the website at
http://georgi.unixsol.org/programs/tsdecrypt/
๐ AUTHORS ๐
Written by Georgi Chorbadzhiyski <georgi@unixsol.org>
๐ LICENSE ๐
This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.
That's the whole vibe from tsdecrypt 10.0, September 2013 โ go decrypt something iconic, bestie ๐
โจ
๐ฆ where this page comes from
- debian bookworm: tsdecrypt 10.0-2.1 ยท GPL-2.0-only
- debian trixie: tsdecrypt 10.0-4 ยท GPL-2.0-only
- ubuntu jammy: tsdecrypt 10.0-2build2 ยท GPL-2.0-only
- ubuntu noble: tsdecrypt 10.0-4 ยท GPL-2.0-only
- ubuntu questing: tsdecrypt 10.0-4
- ubuntu resolute: tsdecrypt 10.0-5 ยท GPL-2.0-only
- ubuntu stonking: tsdecrypt 10.0-5build1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms