— How to configure a satellite capture device

Introduction

To capture recordings from a satellite receiver, Red Hen is currently using the following hardware and software and recommends the following procedure.

Related scrolls

Satellite capture with DVBSky-S960

The DVBSky-S960 V2 USB Box DVB-S2 tuner, available from Amazon.de, is natively supported by a driver in the current Linux kernel.

Recording

After installing the software (see Software installation below), you can make test recordings with the following two commands: 
Recording in SD:
dvbstream -n 60 -o -f 11836 -s 27500 -p h 0 100 101 102 104 106 > /mnt/HD1/test_usb_dvbstream_SD_STDOUT.ts

# Recording in HD:
/home/csa/dvbtools/dvbstream/dvbstream -n 60 -o -f 11494 -s 22000 -p h -s2 -8psk 0 5100 5101 5102 5103 5104 5106 > /mnt/HD1/test_usb_dvbstream_HD_STDOUT.ts

Command line parameters:
f: frequency
s: symbol rate
p: polarization
n: time in seconds to record
o: output to stdout; WARNING: dvbstream also accepts o:file as parameter, but this will still make it set up a network cast of the dvb stream, which is wasteful and unnecessary. Thus we will record to stdout instead.
s2: DVB-S2 (i.e. HD)
8psk: modulation is 8PSK (many if not all HD channels)

All the others are a list of PIDs. All parameter values can for instance be found at satindex channel 335 for the SD channel above or at satindex channel 4880 for the HD channel above. It is important to include the PID for PMT (in this case 100 / 5100) or the file will not play in VLC. It was necessary to include PID 0 for the file to be playable by VLC. [Interestingly it worked without 0 with the stock dvbstream available in the package manager.] With the settings above, the SD file will contain both stereo audio (102) and Dolby Digital Surround Audio (106) but not the MISC audio (103). It should be possible to get rid of one of the Audio streams to achieve a slightly smaller file size. The HD file contains all audio streams (5102, 5103, 5106).

E.g., from the channel scan
CCTV9(NILESAT):12015:v:0:27500:1005:1006:1302

 we have:

-f 12015

-s 27500

-p v

0 1005 1006 (as PIDs)

 

0 may not be necessary, but without it the file will not play in VLC.


For example, 

    dvbstream -n 180 -o -f 12015 -s 27500 -p v 0 1005 1006 > /mnt/HD1/test_usb_dvbstream_SD_STDOUT_CCTV9test2017-06-01.ts

records three minutes of CGTN. 

Egyptian recordings

There are two ways to record on aton:

1) With szap and dvbstream 
 a) Tune to the channel in a separate window (this needs to run continually):
    szap -c w_scan_results-X.txt "AL masriya(NILESAT)" 
 b) record with dvbstream:
    dvbstream -n 120 -o 0 5 106 506 1006 1206 2048 > ts/al_masriyah3.ts 
 2) With dvbstream only
    dvbstream -n 120 -o -f 11765 -s 27500 -p h 0 5 106 506 1006 1206 2048 > al_masriyah4.ts

We recommend the second method because the tuner is only blocked when there is an actual recording. Also, if you start dvbstream before szap has locked to the right channel, it will freeze hard (kill -9 to terminate).

Both resulting files are available in the ts directory on aton. They play absolutely fine in VLC.

The most difficult part is to know which numbers of PIDs to pick here. This can be found at kingofsat in one of the two following lists: NileSat201 and Sat-ab7. However, as you will see, the "TXT" column is empty for both these satellites. So we will not get teletext subtitles. This does not mean that DVB subtitles (the ones that are transmitted as images) are not available - we'll still have to find out whether these are broadcast for individual channels.

Here is the list with comments:

0 - we always need 0
5 - TID (in the grey bar for the transponder)
2048 - NID (in the grey bar for the transponder)
506 - SID (not sure we actually need that)
106 - PMT (some sort of metainfo - without it the file will not play in VLC or Windows Media Player)
1006 - Video PID
1206 - Audio PID

The other parameters for DVBstream (frequency, symbol rate, polarity) are also visible via kingofsat, but also in our scan files (currently in the HD1 directory). See the previous section for what they mean.

The tuning information for Al Masriyah has been added to the script channel_netstream_2017-05-05.sh, which is called by the command "channel", as in this example:

channel 1, 5min, News, 1, 000, "TEST"
The command generated the file /mnt/spool/2017-05-04_2327_EG_Al-Masriyah_News.mpg. So far, this only works for the Al-Masriyah channel; each channel's tuning information must be added to the channel-netstream script. 

Scanning for channels

Run

w_scan -f s -s ?

>to obtain a list of available satellite positions. For Cairo, for instance, this is S7W0, for Astra in Germany S19E2.

Run

w_scan -c ?

to get a list of country codes. For Egypt, this is EG.

Then run the actual scan: [We'll run it 3 times for different output formats]

w_scan -f s -c EG -s S7W0 > /mnt/HD1/w_scan_results.txt

w_scan -f s -c EG -s S7W0 -X > /mnt/HD1/w_scan_results-X.txt

w_scan -f s -c EG -s S7W0 -M > /mnt/HD1/w_scan_results-M.txt

Software installation

To install the driver on a standard Red Hen Raspberry Pi 3B capture station, follow these steps:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install screen

wget http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz
tar xvzf dvbsky-firmware.tar.gz
cd dvbsky-firmware
sudo ./copy-firmware.sh

sudo reboot

The dvbsky driver is now installed, and available as a standard DVB device.

In addition, we need a program to record from the DVBSky-S960 tuner. The only piece of software needed to do this is the latest dvbstream from github:

git clone https://github.com/linuxstb/dvbtools.git

There is a bug in the treatment of the -n [seconds] command line parameter. In order to circumvent that, we will have to make a single modification to the dvbstream source code. Walk into the downloaded directory and edit the source code as follows:

cd dvbtools/dvbstream
nano dvbstream.c

Comment out line 770, i.e. add two slashes at the beginning:

//    if ((secs==-1) || (secs < pids_map[i].end_time)) { secs=pids_map[i].end_time; }

This may break some functionality but we don't need it. Compile dvbstream by issuing

make

It will throw some warnings but should compile.

To give user csa access to the video device, add csa to the group video:

sudo adduser csa video

Log out of user csa and log in again to make the changes effective.