So I ran a self organised session at 33C3 - DVB-S:Pirate or Amateur Digital TV Stations
I figured there wouldn’t be that much interest, so I organised to keep it around the Scottish Consulate / milliways area. I was very wrong… I had way more people than I expected, who were much more interested than I expected. I had clues of this all day, with the regular traffic of people coming and asking at the Consulate about it.
It was really good fun - I enjoyed it an awful lot. I’d like to finish this project off and maybe present the full chain, and all of the subcomponents, in an hour or so at SHA2017. It feels like soemthing I can do that’s achievable, we shall see. Next time, though, I’ll be more organised with my materials.
The slides are available here. They’re a bit bare, so I’ll go through the core content that’s important. Each Heading is probably a new slide:
What is DVB?
DVB is a family of protocols for Digital Video Broadcasting. There are 3 major families - S, C and T for Satellite, Cable and Terrestrial. There is also DVB-H for handheld devices, but the mobile internet explosion has taken over that in most places. They’ve been improved upon over time as new technology has become available, so we now have the ‘2’ variants.
Why am I interested in DVB?
I’m very into amateur radio - There’s a subdivision known as Amateur TV, and there is amateur TV hardware around the UK, on the ISS and soon to be on a geostationary satellite, Es’hail 2.
I’d also like to try and put together a personal TV station I can take to hackercamps - being able to use off the shelf hardware to transmit all of the live talk streams would be an interesting project endpoint. I could then use the same hardware as a DATV station wherever I choose to live.
What DVB shall we use?
Two of the major DVB families are modulated as OFDM - they require generation of multiple carriers. Before SDR this was a lot harder. DVB-S is a single carrier, and can be generated using ‘traditional’ radio techniques quite easily - the BATC have hardware you can purchase to generate the signal quite easily. Video in, DVB-S out. There is also a large base of consumer grade kit that can be used to receive valid DVB-S signals.
As it is already the convention, I’m going to stick with it.
What is DVB?
DVB is comprised, from the perspective of what I care, from two major sections - an MPEG Transport stream, containing my data, error correction, any metadata I wish to make available.
DVB-S, my preferred variety, is modulated as QPSK, Reed Soloman encoded and has Forward Error Correction at a series of rates.
Video is traditionally passed to an encoder to generate a transport stream and the video is fed to the modulator to make it QPSK radio magic.
A two step process should be easy to emulate in open tools.
Satellite TV - Traditional Transmit Path
Satellite TV must be transmitted from a base station, a farm of dishes essentially, and relayed through a satellite such as Astra 2E.
The signal is on two bands - high and low, and can be polarized horizontally or vertically. This, in effect, gives us 4GHz of transmit space, as the two polarizations can overlap with minimal interference.
For broadcasting, it is common to create your signal at a lower Intermediate Frequency, say 1.2GHz, which can be transported in Coaxial cable or waveguide with minimal losses, and then use a mast-mount Block Upconvertor (BUC) to upconvert that frequency to your intended transmit frequency.
Satellite TV - Traditional Receive Path
Satellite TV is received at the client location with a small satellite dish, Low Noise Block Downconverter (LNB), a run of coaxial from the LNB to a set top box.
The STB and LNB aren’t passive antennas - the STB selects the preferred band, ‘high’ or ‘low’, and the desired polarization, ‘h’ or ‘v’ for the LNB to receive by signalling with a voltage and signal on the coaxial cable. I thiiiink this information is usually stored in an almanac that is transmitted by a satellite, but I’ve got nothing to back that belief up with.
The LNB downconverts the tuned frequency to an intermediate frequency around the 1.2GHz band.
Satellite TV - HackRF?
Receiving 10GHz with the darling of the SDR world, the HackRF One is still quite difficult. The biggest issue is the ceiling frequency of 6GHz or so. If you wanted to use an LNB, you’d need to have additional circuitry to power and control the band & polarization.
Things like the RTL-SDR are unusable for this too, they usually have a top frequency of 1.8-2GHz or so.
So how do we generate our own DVB-S stream, if we can’t really use all the Satellite TV Bits?
DVB - DATV
Digital Amateur TV holds the answer. The STB IF, 1.2GHz is an amateur radio allocation. If we cut out the up/down conversion to/from 10-12GHz, we are able to generate and transmit valid DVB-S with a hackRF, and receive it with either a consumer grade DVB-S box, HackRF or RTL Dongle.
That’s much easier.
GNU-Radio blocks exists, Transmit and receive hardware exists and, in the UK at least, DATV repeaters exist to test and calibrate our toolset against. Can we do it with open tools?
DVB - DATV Reception
Let’s assume you live in an area with a DATV repeater and want to receive using RTL-SDR or hackRF.
You can tune, using rx_tools, and receive data. This is a good start.
The next step in our chain is demodulation. There are blocks in GNURadio (gr-dvb) if that’s your thing - I’m a bit scared of GNURadio as it’s got a steep learning curve.
I’ve been using a tool called leandvb, which will happily demodulate, in real time, data piped from an SDR.
leandvb will demodulate the SDR data and output an mpeg transport stream - VLC will happily decode transport streams.
Having the correct sample rate is important - over or undersampling will give you too much decode bandwith or too little decode bandwidth. You’ll get blocky decode, errors or nothing at all. Sample rate is calculated as:
SR = Video bitrate/(2*(188/204)*FEC)
Assuming you know the information that’s missing, it’s super easy to work out!
DVB - DATV Transmission
Transmission for me happens in two steps:
I generate an MPEG Transport Stream, and then feed that to the DVB-S modulator. At the moment I’m using FFMPEG for TS Generation. I’ve been told it doesn’t generate a valid TS, so dedicated hardware may struggle to decode, but VLC only complains a little.
DVB - DATV Transmission - FFMPEG
This slide is nonsense! here’s the useful information copy-pasted. If you follow the command, you can see I’m encoding Big Buck Bunny as 640x480 mpeg2 video, frame rate of 25fps, video bitrate of 1.5Mbit. ffmpeg is forming a transport stream, adding our multiplex rate, metadata information and drawing an overlay of my radio callsign. This is output to a file called test2.ts
ffmpeg -re -thread_queue_size 1000 -i Videos/big_buck_bunny_480p_surround-fix.avi -vcodec mpeg2video -s 640x480 -r 25 -acodec mp2 -b:v 1.5M -minrate:v 1.5M -maxrate:v 1.5M -bufsize:v 2M -ac 2 -b:a 128k -mpegts_transport_stream_id 1025 -mpegts_service_id 1 -mpegts_pmt_start_pid 0x0fff -mpegts_start_pid 0x0121 -muxrate 2M -metadata service_provider="MM3ZRZ" -metadata service_name="Big Buck Bunny" -f mpegts -vf "drawtext=fontfile='/usr/share/fonts/truetype/freefont/FreeSans.ttf':text='MM3ZRZ-70cm DATV':x=60:y=34:fontsize=20:fontcolor=0xffffff7f" -y test2.ts
DVB - DATV Transmission - Modulation
GNURadio has the blocks - I’ve blogged about G0FCU‘s GNURadio file before.
I’ve been using rpidatv and bitbashing the GPIO on a raspi. rpidatv generates valid I/Q, so my future project is to try and use soapySDR to take this output to an SDR. That would make the raspberry pi a nice little portable TV station, which is my end goal.
Taking the output of rpidatv to SDR would be nice, I look forward to being able to do that.
Looking further out than that, Es’Hail 2 satellite has a 2.4GHz to 10GHz transverter, and 8MHz bandwidth for DVB experiments. I’d like to be able to transmit to that, so I’ll need to build a 2.4GHz transmit chain.
Amplifiers are already available, and high gain antennas are very common, so I don’t think this’ll be too much of an issue. But then again, every project is really easy before you’ve started it.