Hacktv: analogue tv transmitter

Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
Thought I'd start a separate thread on HackTV and any updates to go here, rather than all over the place.

Some threads that started HackTV's various features:


What is it?

As the thread title suggests, it's an analogue TV transmitter made, primarily, for HackRF SDR. Other SDRs, such as Pluto, BladeRF and LimeSDR are supported but your mileage may vary. It also supports fl2k device for baseband output. Works best on Linux based OSs or Mac, though there is a script to compile it for Windows. @steeviebops is your man for this!

Main features:
  • Pretty much all analogue systems are supported, from Baird 30 line to MAC, to SECAM 819, to Apollo TV.
  • A variety for scrambling systems used for PAL, SECAM and D/D2MAC.
  • Modulation in FM, VSB/AM and baseband, so will be good for either your old satellite receiver or directly into your TV.
  • Stereo NICAM audio.
  • Teletext.
  • Subtitling
  • Can stream from pretty much anything - either a file or a web stream accepted by ffmpeg or a utility such as youtube-dl for direct streaming from YouTube. Who thought you'd could transmit YT in analogue, eh?
  • Scrambling:
    • Videocrypt I
      • Needs any active Sky card between series 6 and 12 or in free-access mode, not requiring a card.
      • Dead Sky 07 and 09 cards can be activated with HackTV.
    • Videocrypt II
      • Needs an active Multichoice card. Or a programmed PIC card.
    • Syster/Nagravision
      • Supports most 'keys' (cards shaped like keys) used in Europe. Or a programmed PIC card.
    • Discret 11
      • Uses "audience 7"/free-view mode. Works with real Discret decoders and Syster ones with a valid key as above.
    • Eurocrypt M
      • Works with official active FilmNet, TV Plus Holland, Viasat (TV1000) or "Multimac" cards.
      • Supports single and double cut mode (scrambling of chroma only or chroma and luma).
Versions:

There are two main versions of HackTV. One is the official release by @fsphil, who's done the vast majority of the work and one that has less bugs :). The other one has been somewhat extended by yours truly to mainly cater for conditional access systems and some other features that may not really warrant inclusion in the main release. Check README files in each repo.

There's a GUI front-end for Windows version of HackTV by @steeviebops if you prefer to click buttons instead of typing stuff out :)
 
Last edited:
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
New update in official repo with fixes for D/D2MAC timings and scrambling.

Added double-cut scrambling in fork.
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
Thanks for the mention! :) I've uploaded Windows binaries of today's new updates to the OneDrive.

Had some issues compiling your fork though (in both Ubuntu and for Windows). Looks like some of the syntax is platform-specific - I assume you're building this on MacOS as it appears to be BSD syntax?

I can get it to compile by replacing the ‘uint32_t' command with the command suggested by the error. It returns some warnings but compiles and appears to work OK.

Linux errors and warnings:
Code:
font.c: In function ‘get_line_width’:
font.c:270:9: warning: variable ‘l’ set but not used [-Wunused-but-set-variable]
  270 |  int i, l;
      |         ^
gcc -g -Wall -Wno-unused-result -pthread -O3  -I/usr/include/x86_64-linux-gnu -I/usr/include/ -I/usr/include/libusb-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/freetype2 -I/usr/include/libpng16 -c subtitles.c -o subtitles.o
subtitles.c: In function ‘parse_time’:
subtitles.c:125:19: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  125 |   if(c == ti && t != i)
      |                 ~~^~~~
gcc -g -Wall -Wno-unused-result -pthread -O3  -I/usr/include/x86_64-linux-gnu -I/usr/include/ -I/usr/include/libusb-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/freetype2 -I/usr/include/libpng16 -c bitmap.c -o bitmap.o
In file included from bitmap.c:18:
bitmap.h:23:27: error: unknown type name ‘uint32_t’; did you mean ‘u_int32_t’?
   23 | extern void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height);
      |                           ^~~~~~~~
      |                           u_int32_t
bitmap.h:23:44: error: unknown type name ‘uint32_t’; did you mean ‘u_int32_t’?
   23 | extern void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height);
      |                                            ^~~~~~~~
      |                                            u_int32_t
bitmap.c:23:20: error: unknown type name ‘uint32_t’; did you mean ‘u_int32_t’?
   23 | void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height)
      |                    ^~~~~~~~
      |                    u_int32_t
bitmap.c:23:37: error: unknown type name ‘uint32_t’; did you mean ‘u_int32_t’?
   23 | void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height)
      |                                     ^~~~~~~~
      |                                     u_int32_t
make: *** [Makefile:32: bitmap.o] Error 1
Windows errors:
Code:
In file included from bitmap.c:18:
bitmap.h:23:27: error: unknown type name 'uint32_t'; did you mean 'wint_t'?
   23 | extern void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height);
      |                           ^~~~~~~~
      |                           wint_t
bitmap.h:23:44: error: unknown type name 'uint32_t'; did you mean 'wint_t'?
   23 | extern void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height);
      |                                            ^~~~~~~~
      |                                            wint_t
bitmap.c:23:20: error: unknown type name 'uint32_t'; did you mean 'wint_t'?
   23 | void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height)
      |                    ^~~~~~~~
      |                    wint_t
bitmap.c:23:37: error: unknown type name 'uint32_t'; did you mean 'wint_t'?
   23 | void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height)
      |                                     ^~~~~~~~
      |                                     wint_t
make: *** [Makefile:32: bitmap.o] Error 1
make: *** Waiting for unfinished jobs....
eurocrypt.c: In function '_permute_f':
eurocrypt.c:285:28: warning: array subscript has type 'char' [-Wchar-subscripts]
  285 |   s |= (unsigned long)SB[i][v] << (28 - 4 * i);
 
Last edited:
fsphil

fsphil

Member
Messages
97
My Satellite Setup
Still playing with analogue. Also running a Humax FOXSAT-HDR and a Thomson THS804.
My Location
UK
uint32_t is defined in stdint.h, make sure that's included at the top
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
Thanks both. Strangely, I do not get those errors on my Mac.

Give the new push a go.
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
Thanks both. Strangely, I do not get those errors on my Mac.

Give the new push a go.
Excellent, works fine now for both Linux and Windows. For Windows I use my custom build script and need to edit hacktv.c and ffmpeg.c to change the directory separators.
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
OK good. Which directory separators do you need to change?
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
I noticed the following in hacktv.c and ffmpeg.c:

Code:
#ifdef WIN32
#define OS_SEP '\\'
#else
#define OS_SEP '/'
#endif
and
Code:
asprintf(&vid_conf.logo,"resources%clogos%c%s", OS_SEP, OS_SEP, s.logo);
Correct me if I'm wrong but this looks like "if Win32, define the variable as "\" otherwise it is "/". If I leave this as-is and compile, --logo can't find the PNG files. If I change it back to / then it works fine. So you can remove the variable altogether.
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
Strange. Perhaps the compiler knows what path separators to use without this.
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
What’s the syntax for the subtitle parameter? Is it just the index number of the subtitles in the video file? I’m looking at implementing it in the GUI but will need to make some changes to the layout to accommodate it.
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
It's just an index to subtitle stream - an integer. Usually 2 or 3 but depends on the number of audio tracks present. By default, it picks the first available one and the parameter is optional, so I'd just put a check box rather than a selection. In case of external subtitles (srt files), the parameter is ignored anyway.

The whole thing is experimental and @fsphil will probably release something more stable (bits of code are all over the place here).
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
Out of interest, what sort of hardware are you all using for this? My laptop struggles with the filter command on AM modes (but not on FM).


My laptop would have been a beast in its day but that was 2013! I've started playing with GNU Radio recently and found it has the same issue with FM RDS graphs. To rule out any possible Windows issue, I also ran it on Ubuntu (not in a VM by the way) but the result was the same.
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
I am using a 2015 iMac - Skylake i5 processor.

--filter in AM mode is flaky for me. @fsphil suggested changing the number of taps used for it. Line 2051 in original code.

I find that the max on my machine is around 35 taps but does underflow now and again. I settled on 25.

Maybe make it an optional parameter?
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
Thanks. I probably should have said that I’m on an Ivy Bridge i7 so it is fairly old now. I’ve been considering replacing it with something newer but would want to be sure it’ll do what I‘d like.
 
fsphil

fsphil

Member
Messages
97
My Satellite Setup
Still playing with analogue. Also running a Humax FOXSAT-HDR and a Thomson THS804.
My Location
UK
There is still some room for improvement in how the filter works. Currently my laptop (Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz) struggles, but my desktop (Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz) handles it fine in most cases.
 
S

steeviebops

Member
Messages
63
My Satellite Setup
A basic 28.2 Freesat config, but have had a long history of satellite TV dating back to the analogue 19.2 days. Using a HP ZBook 15 G5 laptop (Core i7-8850H, 32GB RAM, Quadro video card)
My Location
Drogheda, Ireland
Well I picked up another beast yesterday. A HP ZBook 15 G5 with a Core i7-8850H. Runs anything I throw at it, including the filter!
 
Captain Jack

Captain Jack

Модератор
Staff member
Messages
11,013
My Satellite Setup
See signature
My Location
North Somerset
@fsphil released an update for D/D2MAC with Eurocrypt, which includes video AND audio scrambling.

 
Top