Meteor M-N2 Images

Sunday, 7 June 2015

Transmitting video with a HackRF Blue

Picture of the video of my garden transmitted by my HackRF Blue
In the UK much digital amateur television (DATV) is transmitted using the DVB-S standard. This is the standard used in Europe to transmit standard definition satellite television.

Eventually I aim to transmit video through my local DATV repeater. What I have done is to prove the feasibility of using a HackRF Blue to act as the radio frequency part of the system.

I have drawn a diagram showing the individual components I used and I will go on to describe each in more detail.
Camera
I have used a standard DV video camera (Canon MV450i). It is possible to substitute this for a standard webcam. 

Computer
I use a 4 core Intel Core i5-2400, 3.10GHz CPU with 4Gb of memory. Operating system is xubuntu 14.04.

dvgrab
This software is used to grab the DV stream from the Firewire port that the DV camera is connected to. If you use a webcam then it is not necessary to use this program. It can be installed from the Ubuntu Software Centre or via the Kino pages.

ffmpeg
ffmpeg is used to convert the raw video stream grabbed by dvgrab into an MPEG-2 transport stream. If you are using a webcam you will need to change the parameters for the input source and the input video codec. It can be installed from the Ubuntu Software Centre or from the ffmpeg site.

The output from ffmpeg is sent to a fifo file to be consumed by the gnuradio program.

gnuradio
I have gnuradio installed via pybombs and am currently running version 3.7.7. Ron Economos has written the gnuradio blocks to enable DVB-S to be transmitted. You will need to download & install these from github. Included in the download is a gnuradio-companion flowgraph. Open this in gnuradio-companion to verify that you have installed the DVB-S gnuradio blocks in the correct place. If blocks show up as red then you haven't. However, Ron's code does not use a HackRF so I have changed the output sink to be a HackRF. You may also want to change the input to be a mpeg-2 transport stream file for testing and/or to reflect the location of the fifo file on your system.

You can download my HackRF version of the transmit program from here and edit it to change the reference to the directory I used for my fifo file to the one on your machine.

Example commands

One off commands

  • mkdir ~/dvb-s
  • cd ~/dvb-s
  • mkfifo mpeg2.fifo

Command to run dvgrab and ffmpeg

cd ~/dvb-s

dvgrab - | ffmpeg -re -thread_queue_size 1000 -i /dev/stdin -vcodec rawvideo -f alsa -i hw:0,0 -acodec mp2 -s 640x480 -r 25 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -ac 2 -b:a 48k -mpegts_transport_stream_id 1025 -mpegts_service_id 1 -mpegts_pmt_start_pid 0x0fff -mpegts_start_pid 0x0121  -muxrate 2M -f mpegts -y mpeg2.fifo

I suspect that some of these parameters are surplus to requirements but these are what worked for me.

To use a webcam remove "dvgrab - |" from the start of the line and substitute "-i /dev/stdin -vcodec rawvideo"  with "-i /dev/video0 -vcodec mpeg2video"

To test that this step is working you can use mplayer to consume the video feed from the fifo file:
mplayer mpeg2.fifo

To transmit the video stream open another terminal window
cd ~/dvb-s
./dvbs_tx_hackrf.py

The transmission looks like this when received by gqrx on another HackRF.



How to receive the signal.

I used a standard DVB-S satellite TV receiver. However, these use an LNB which mixes the 10/11GHz signal with a 9750 MHz (or 10700 MHz) local oscillator (LO) to produce a signal around 1000-1250 MHz. In this case we do not use the LNB but connect an antenna directly to the input port where the LNB usually connects. 

WARNING: the antenna port has 13/18 Volts on the centre core. Do not allow your makeshift antenna to short across the inner and outer of the antenna port or you may damage your receiver.

In my example I have the HackRF Blue transmitting on 1000 MHz. I set the receiver to receive on 10750 MHz. As the LO is at 9750 MHz, 9750 plus 1000 = 10750. You need to know the LO your LNB is using (it is normally marked on them or try both values). So, I set the satellite receiver to scan for a signal on 10750 MHz. 

The other value the receiver needs to know is the symbols/second value. In the gnuradio program I have set it to 2 million symbols/second. Most satellite receivers will receive a minimum of 2m sym/sec, and this is the value you need to set in the receiver (or 2000k sym/sec). FEC can also be specified but my receiver set this to 'AUTO'.

Antenna

My satellite receiver is located underneath the television in an adjacent room to my study. Due to the use of a dummy load the transmission can only be received if the antenna from the satellite receiver is close to the dummy load. I used a length of satellite co-axial cable long enough to reach between both rooms, terminated one end with a F-type plug to fit the antenna socket of the satellite receiver. At the other end I connected the inner core of the co-ax to the driven element of a 1296 MHz beam I made recently. The outer core I taped up with insulating tape to ensure that it was not going to short to the inner conductor.

I haven't tried this but if you expose 7.5 cm of the centre conductor having cut back the outer sheath, the outer shield of copper and the inner dielectric (taking care not to short the inner and outer conductors) this should work as a quarter wave antenna at 1000 MHz. You will probably have to hold it very close to the dummy load connected to the HackRF Blue to receive the signal. 

WARNING: Wrap the centre conductor you expose in insulating tape to prevent accidental shorting as there is still 13/18V on the centre conductor.

With my 23 cm beam pointing at the dummy load I was able to receive the signal about 5 metres away.
 
References

Explanation of the ffmpeg parameters here and here.

Details of transmitting DVB-T using a webcam here.

Legal advisory

It is illegal to transmit on radio frequencies for which you do not possess a valid licence issued by your government. I hold an amateur radio licence so am allowed to transmit on a set of defined frequencies. However, for this experiment I transmitted into a dummy load, meaning that the transmission was not radiated more than about 3 metres.

For more information on becoming a radio amateur please contact your national amateur radio organisation. See the list here.

The small print

If some or other part of this doesn't work for you please don't send me a curt email saying "It doesn't work". It works for me on my system so try and understand why it doesn't work and adapt it to your environment.