/hacktv

Analogue TV transmitter for the HackRF

Primary LanguageCGNU General Public License v3.0GPL-3.0

 -[ HackTV - Analogue TV transmitter for the HackRF ]-

This is a fork of https://github.com/fsphil/hacktv with some additional features
added. Most of them are those which I personally use, though not necessarily
warrant inclusions into original source.

I will try and keep this as up to date as possible with official releases.

**All credit for original code goes to author (fsphil)**

2021-11-10
Rework Videocrypt routines for, hopefully, easier reading and adding new modes.
Removed "tac1" and "tac2" Videocrypt modes and replaced with a single "tac" one. This works with all my TAC cards.

2021-10-28
Add Videocrypt nanocommands for Sky 09 cards. This will only work with official Sky 09 cards, which still have nanos active. Not many do.
  Enable with --sky09nano

2021-10-08
Add PPV mode to Eurocrypt. Only works with official cards with, ideally, some credits loaded onto them.
  Enable with --ec-ppv <prog_num,prog_cost> (for example, --ec-ppv 12,54 will specify program number 12, which costs 54 tokens)

Once the program number has been enabled, it will stay enabled. Specifying a program cost of 0 (or not at all) will work on most Eurocrypt-M
cards with no credits loaded.

2021-09-25
Add maturing rating to Eurocrypt for use with official cards. 
Takes values from 0 (disabled) to 15.
  Enable with --ec-mat-rating <0-15>

2021-03-26
Add teletext subtitles on page 888. Can be viewed either using teletext
or selecting "English Subtitles" if using a D/D2MAC decoder.
  Enable with --txsubtitles

2021-03-13
Add --downmix option to convert 5.1 (and others) to 2.0 stereo
Add --volume option to ...well, what it says on the tin

2021-02-12
Tons of -alleged- improvements:
  - Remove dependency on external resources during runtime, such as fonts and PNG images
  - Added PM5544, UEITM and FUBK test cards. Activate with test:pm5544 ...
  - Removed many ffmpeg filters - replaced with native functions

2021-01-06
A much improved Syster cut and rotate implemention (credit to fsphil).
Allow combining Syster line shuffling and cut and rotate to operate simultaneously.

2020-12-16
Addeed a very rudimentary Syster "cut and rotate" mode. Only works on Premiere decoders.
  Run with --systercnr at multiples of Syster line sampling rate, such as 17750000 (4x 4437500).

Removed references to "Smartcrypt" - a similar cut and rotate system but likely not what this is.

2020-11-06:
Added option to specify Syster permutation table to use.

2020-10-23:
A few changes to Eurocrypt, including the addition of EMMs for Eurocrypt-M. 

To test it, program your card with the newly supplied Multimac PIC files
and run hacktv using Eurocrypt mode "tv3update". The card will update 
within 30 seconds.

2020-08-05:
Added HTB+ Russia for Syster
Added Videocrypt PPV mode for use with old phone cards
  - Requires either dumping of phone card or brute forcing key
    Card serial are bits 0 to 39 (each of the five bytes bit-reversed)
    Card key are bits 40 to 49 (each byte is bit reversed)
    Put this data in _ppv_card_data[] in videocrypt.c
  
  Alternatively:
  - Use --showserial parameter to display card's serial on screen
  - Use --findkey to brute force the two random bytes. 
    You need to watch the screen until it clears and it may take up to 45 hours!
    If the process is interrupted, you can change starting values in videocrypt.c
    
    /* Starting keys */
    _ppv_card_data[5] = 0x00; /* Key a */
    _ppv_card_data[6] = 0x00; /* Key b */

2020-07-24:
Added sizing options for 4:3 screens (--letterbox and --pillarbox).

2020-05-13:
Added ability to enable and disable Multichoice Videocrypt2 cards (experimental - at your own risk!).
Small tidy-ups.

2020-04-24:
Added Eurocrypt S2 mode with additional cards/modes (experimental).

2020-04-21:
Added Eurocrypt double-cut scrambling for MAC modes.
  - Activate with --double-cut. See help for options.

2020-04-17:
Added ability to display subtitles - either those within a container or external srt.
  - Active with --subtitle <subtitle index> parameter (optional argument)
Added Eurocrypt M scrambling for MAC modes.
  - Activate with --eurocrypt <mode>. See help for options.

2020-02-07:
Added ability to enable or disable Sky 07 and 09 cards.
  - Activate with --enableemm/--disableemm <card_serial> (first 8 digits)
Added --showecm option for conditional access debugging.
Added ability to use Videocrypt I and II together in most modes.
Some updates to Syster code.

2020-01-09:
Removed 'pirate' option from Syster. Use 'premiere-fa' mode and the updated hex file. 

2020-01-07:
All available Syster modes are now using random control words.
See hacktv command line help for options.

2020-01-06:
Added Canal+ Poland key "free access" (audience 11) mode. Should work with most C+ PL keys.
Added Canal+ France key "free access" (audience 11) mode. Should work with most C+ France keys.
Fixed D11.

2020-01-02:
Added Syster DES function for random control words.
'syster' parameter now requires 'premiere' or 'pirate' option.
New hex file for PIC - use your own decryption keys.

2019-12-27:
Videocrypt 2 conditional access mode added.
  - use Multichoice Central Europe card or included hex file for PIC16F84 card.
General tidy ups.
'key' option removed - see help from hacktv.

2019-12-11:
Added Sky 10 (0A) series card to Videocrypt.
  - Activate with --key sky10
  - Activate with --key sky10ppv for PPV event (samples taken from Tyson fight in '96)

2019-12-06:
Added Sky 07 (and maybe 06) series card to Videocrypt.
  - Activate with --key sky07
General tidy-ups.

2019-07-26:
Added Sky 09 series card to Videocrypt.
  - Activate with --key sky09
  - Sky 11 series can be activated with --key sky11
Minor changes and tidy-ups.

2019-05-17:
Added Discret 11 scrambling in audience 7/free access mode. Use --d11 option.
  - Best results with sampling rate 10MHz or 20MHz (until I figure out how to delay properly)
Added PIC hex file for Syster and D11 when used in Syster decoder.

2019-04-30:
Holding screen for when position of the video is defined - can sometimes takes a few seconds.
Added xtea algo for Videocrypt 1. Use --key xtea option.
Added Funcard hex for Videocrypt 1.

2019-04-25:
Merged hardware support for Syster from original repository.

Changes and additions:
Control Word change for Videocrypt TAC mode - tested working on a real TAC card.
Widescreen/anamorphic videos are now appropriately letterboxed instead of being stretched vertically.

Extra options added:
  --position <value>  Set start position of video in minutes.
  --timestamp         Overlay video timestamp over video.
  --logo <path>       Overlay picture logo over video. Logos are kept in
                      resources/logos folder.

2019-04-07:
PAL FM deviation changed to 6000000 kHz and default signal level reduced to 0.8

Conditional Videocrypt mode requires --key sky|tac parameter. This specifies
which card you want to use to decode video. 

  sky09 = this works with an active Sky 09 series card and uses randomly generated 
          control words.
  sky11 = this works with an active Sky 11 series card (blue semi-oval logo) and 
          uses two fixed control words.
  tac   = this works with an active The Adult Channel or Eurotica card and uses 
          randomly generated control words.

  Hex files for "sky09" and "tac" modes are included in PIC directory to flash 
  your own PIC16F84 based cards. Old pirate D2MAC cards based on this chip will 
  work. These cards are also known as "Goldwafer" or "Multimac" - only PIC chip
  needs to be flashed. External EEPROM is not used.

**Original README text is below.**
https://sanslogic.co.uk/hacktv

WHAT'S IT DO

Generates a PAL, NTSC, SECAM, D/D2-MAC video signal from a video file, stream
or test pattern. Also supports older 819, 405, 240 and 30 line standards, as
well as the NASA Apollo video standards, both colour and mono.

Input is any file type or URL supported by ffmpeg.

Output can be to a file, HackRF, fl2k-supported VGA adaptors or any SDR
supported by SoapySDR.

It also supports:

+ Teletext (625-line only)
+ NICAM stereo audio
+ Videocrypt I/II/S hardware support
+ Partial Nagravision Syster hardware support
+ Analogue Copy Protection system, similar to Macrovision
+ Eurocrypt hardware support


WHAT'S IT NOT DO (yet)

+ An optional notch filter for the colour subcarrier would be nice


WHAT IT WON'T DO

+ DVB or other pure digital signals
+ Bring back Firefly :(


REQUIREMENTS

Depends on libhackrf and various ffmpeg libraries.

* For Fedora (with rpmfusion)
yum install hackrf-devel osmo-fl2k-devel SoapySDR-devel ffmpeg-devel

* For Debian and related
apt-get update
apt-get install libhackrf-dev libavutil-dev libavdevice-dev libswresample-dev libswscale-dev libavformat-dev libavcodec-dev

* On Debian (sid)
apt-get install hacktv


WARNING

The hackrf is not designed to be connected directly to AV equipment and could
be damaged by, or cause damage to, your receiver. Please ensure no DC voltages
or control signals are sent back into the hackrf, and that the RF power levels
out of the hackrf are not too high for your receiver.


INSTALL

cd src
make
make install


EXAMPLES

# Generate a file containing a PAL baseband signal from a video
$ hacktv -o baseband.bin -m pal example.mkv

# Transmit a test pattern on UHF channel 31 (PAL System I), 47dB TX gain
$ hacktv -f 551250000 -m i -g 47 test

# Transmit a test pattern with teletext
$ hacktv -f 551250000 -m i -g 47 --teletext demo.tti test

# Download and transmit teletext pages from the Teefax service
$ svn checkout http://teastop.plus.com/svn/teletext/ teefax
$ hacktv -f 551250000 -m i -g 47 --teletext teefax test

# Transmit two channels simultaneously on UHF channel 68 and 69 (PAL I)
$ hacktv -s 20000000 --offset -6.75e6 --level 0.5 --filter -o - test | hacktv -s 20000000 -f 854e6 --offset 1.25e6 --level 0.5 --passthru /dev/stdin -g 47 --filter test

# Grab and transmit the local display (X11)
$ hacktv -f 551.25e6 -m i -g 47 -ffmt x11grab --fopts framerate=25 ffmpeg::0

LINKS

https://github.com/captainjack64/hacktv - Fork of hacktv with support for additional scrambling systems
https://github.com/steeviebops/jhacktv-gui - A cross platform GUI for hacktv written in Java


-Philip Heron <phil@sanslogic.co.uk>