tsdecrypt reads incoming mpeg transport stream over UDP/RTP and then decrypts it using code words obtained from OSCAM or similar cam server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol.
tsdecrypt is released under GNU GPL v2.
tsdecrypt depends on openssl. It uses rand, MD5, DES and AES functions. You probably already have openssl installed. If you are seeing compilation errors related to missing openssl headers you should install openssl development package using 'sudo yum install openssl-dev' or 'sudo apt-get install libssl-dev' or similar command depending on your Linux distribution.
If you are not using shipped FFdecsa then the other tsdecrypt dependency is libdvbcsa. libdvbcsa can be downloaded from https://www.videolan.org/developers/libdvbcsa.html
tsdecrypt supports two different CSA decryption libraries.
libdvbcsa is an external library from VideoLAN project released under LGPL, FFdecsa is shipped with tsdecrypt.
libdvbcsa is better tested and have served tsdcrypt for a long time so it is still the default decryption library. Also it is faster with file input.
To compile tsdecrypt with libdvbcsa run 'make' or if you have tested FFdecsa compilation and want to switch to libdvbcsa run 'make dvbcsa'. 'make distclean' switches decryption library back to libdvbcsa.
FFdecsa support was added after tsdecrypt v7.0. FFdecsa can be up to 40% faster than libdvbcsa especially on 32-bit hardware. If you want to use FFDecsa you have to run 'make ffdecsa'.
The setup script will test which FFDecsa algorithm is the fastest for your CPU and will configure tsdecrypt compilation to stop using libdvbcsa. Most likely the script will choose PARALLEL_128_SSE or PARALLEL_128_SSE2. Once the script have finished it stores its decision in FFdecsa.opts file and as long as this file exists tsdecrypt will be compiled with FFdecsa. You can force regeneration by deleting running 'make ffdecsa_force' or 'make distclean ffdecsa'.
FFDecsa is considerably slower than libdvbcsa when tsdecrypt's input is a file or stdin (single packet decryption mode). If you are decrypting already recorded files you are better of using libdvbcsa.
When tsdecrypt is run it reports which decryption library is used in its version string. You can use --bench option to test decryption speed.
The development is done using git. tsdecrypt repository is hosted at https://georgi.unixsol.org/git/gfto/tsdecrypt
To clone the repository issue the following commands:
git clone https://georgi.unixsol.org/gfto/tsdecrypt.git cd tsdecrypt git submodule init git submodule update make
The code is developed and tested under modern Linux. It is also compiled from time to time under OS X but is not tested there.
To see all Makefile targets run 'make help'.
To update cloned tsdecrypt, go to the directory where the repository is cloned and run the following commands:
git fetch origin git merge origin/master git submodule update make clean all
tsdecrypt's master branch should always be useful so it is safe to use it instead of official release. The master branch will always be better than any released version.
tsdecrypt is controlled using command line parameters. For more information about the parameters see the man page. Here is a list of supported command line parameters:
Main options:
-i --ident
Input options: -I --input
Output options:
-O --output
CA options:
-c --ca-system
CAMD server options:
-A --camd-proto
EMM options:
-e --emm | Enable sending EMM's to CAMD. Default: disabled
-E --emm-only | Send only EMMs to CAMD, skipping ECMs and without
. decoding the input stream.
-Z --emm-pid
ECM options:
-X --ecm-pid
-q --ecm-and-emm-only | Send ECMs and EMMs to CAMD but do not decode . the input stream.
Logging options:
-S --syslog | Log messages using syslog.
-l --syslog-host
Debugging options:
-n --ecm-file
Misc options: -j --pid-report | Report how much packets were received. -b --bench | Benchmark decrypton. -h --help | Show help screen. -V --version | Show program version.
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, see man page or program help for more options.
Examples:
tsdecrypt --camd-server 10.0.1.1 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
tsdecrypt --emm --camd-server 10.0.1.1:2233 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
tsdecrypt --no-output-filter --emm --camd-server 10.0.1.1 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
tsdecrypt --camd-server 10.0.1.1 --input-service 1234 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
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
tsdecrypt --camd-server 10.0.1.1 --ca-system NDS --caid 0x0963 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
tsdecrypt --camd-server 10.0.1.1 --emm-only --caid 0x0963 \ --input 239.0.50.11:5000 --output /dev/null
tsdecrypt --camd-server 10.0.1.1 --caid 0x5581 \ --input 239.0.50.11:5000 --output 239.78.78.78:5000
tsdecrypt --biss-key 0x112233445566 --input 239.0.50.11:5000 \ --output 239.78.78.78:5000
tsdecrypt --const-cw 0x00000000000000001111111111111111 \ --input encrypted-file.ts --output file://decrypted-file.ts
tsdecrypt --ecm-file ecm.txt --caid 0x5581 --input-service 12345 \ --camd-server example.com
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
In order for tsdecrypt to communicate with OSCAM using cs378x (camd35 over tcp) protocol you can use configuration like the examples bellow.
[account] user = user pwd = pass group = 1 au = 1 uniq = 0 monlevel = 4
[cs378x] port = 2233
In order for tsdecrypt to communicate with OSCAM using newcamd protocol you can use configuration like the examples bellow.
[account] user = user pwd = pass group = 1 au = 1 uniq = 0 monlevel = 4 ident = 0604:000000 caid = 0604
[newcamd] port = 1122@0604:000000 serverip = 0.0.0.0 key = 0102030405060708091011121314
The above example allows tsdecrypt clients using newcamd to retrive keys from OSCAM serving CAID 0x0604 (Irdeto) on port 1122.
If you think you have found bug in tsdecrypt, please report it to the e-mail listed in Contact section (see below) of this README file.
When reporting bugs, please send the contents of tsdecrypt.log file generated by using the following command (fill in YOUR_OPTIONS):
tsdecrypt --debug 1 --log-file tsdecrypt.log YOUR_OPTIONS
Also write the full command line which you used and describe what you think the tsdecrypt does wrong.
One commonly seen error is not an error in tsdecrypt at all. You have to make sure that the software that streams channels from the DVB card is sending ECMs and EMMs along with other streams. If these streams are missing you'll probably get the following messages from tsdecrypt:
2012-04-02 22:02:12 | ECM | Received 0 (0 dup) and processed 0 in 3 seconds. 2012-04-02 22:03:09 | CW | ERR No valid code word was received for 60 seconds! 2012-04-02 22:03:12 | ECM | Received 0 (0 dup) and processed 0 in 60 seconds.
Please configure your software to stream ECMs and EMMs. For dvblast (version 2.0 and above) the correct options are --ecm-passthrough and --emm-passthrough. Note that dvblast 2.1 have broken ecm passthrough so use at least version 2.2.
Official releases can be downloaded from tsdecrypt home page which is
https://georgi.unixsol.org/programs/tsdecrypt/
For patches, bug reports, complaints and so on send e-mail to
Georgi Chorbadzhiyski georgi@unixsol.org