Dektec DTU-315 and Linux - Intro to TSduck

December 18, 2023   

TL;DR:

My adventures with DEKTEC DTU-315 DVB Modulator under linux..

What is DTU-315 ?

DTU-315 is a DVB RF digital signal modulator. It is used to play TS files to your STB or TV which has DVB tuners ( Satellite , Terrestrial or Cable )

DTU-315 supports:

  • DVB-S/S2
  • DVB-T/T2
  • DVB-C/C2
  • And many more

During development & debugging of DVB tuners, DTU-315 is a very handy tool. For details, please visit its website.

Here is my DTU-315:

Of course there are alternative modulators out there in the market, but I find dtu-315 to be the most convenient one to use.

Running DTU-315 under windows

Dektec provides a GUI application called StreamXpress for Windows . It is very easy to install and use. When you run the installer, it also installs windows drivers so it is plug & play.

One major advantage of StreamXpress app under windows compared to Linux is that it can automatically calculate various modulation parameters , so the playback is almost everytime smooth when using windows. Sadly, I am not aware of any app that support this under linux.

Dektec does not provide any official app for linux.

Running DTU-315 under linux (ubuntu)

First of all, you will need linux kernel modules. These can be obtained from here: https://github.com/tsduck/dektec-dkms

Just visit releases page and download your DEB file, and install. I summarised my adventure here: https://github.com/tsduck/dektec-dkms/issues/6

What is TSDuck ?

TSduck can be defined as a transport stream processor (toolkit) application suite.

Please see a perfect introduction to tsduck here: https://tsduck.io/

It is cross-platform and it is one of the best opensource application that I have ever seen before. The documentation quality, code quality, support quality…all is amazing. big kudos to the author.

TSduck can be used with various hardware ( both for aqusition and modulation) : https://tsduck.io/download/docs/tsduck.pdf ( Go to “Hardware Device Support” )

In this blog, I will focus on modulation part. I am planning to write another blog regarding aquisition: TBS5530 with TSduck.

DVB-S / S2 Modulation - Playback of TS

After your DTU-315 is up & running in dmesg, now we can try playing some DVB-S TS file with TSduck:

DVB-S/S2 Playback

tsp --verbose -P analyze --ts-analysis --interval 3 -I file --infinite TSFILES/Turksat_12209_H_10000_21_Oct_2023_HABERTURK-1.1Gbyte.ts -O dektec --modulation DVB-S2-8PSK --satellite-frequency 12209000000 --lnb 9750,10600,11700 --convolutional-rate 3/4 --symbol-rate 10000000 --roll-off 0.20 --pilots

The result looks like here:

The important hint for me was to make sure input bitrate ~ output bitrate. When this is not achieved, I saw various video artifacts, but when they are almost equal, playback for long durations are flawless.

I wrote my adventures of achieving this here: https://github.com/tsduck/tsduck/issues/1318

DVBS FHD TP Playback

tsp --verbose -I file --infinite TSFILES/Turksat_12015_h_27500_21_Oct_2023_NTV_Group.ts -O dektec --modulation DVB-S-QPSK --satellite-frequency 12015000000 --lnb 9750,10600,11700 --convolutional-rate 5/6 --symbol-rate 27500000 --roll-off 0.20 --pilots

No AV stuttering, perfect playback on US3300 with RDK5.2.2

DVBS Radio Only TP playback

tsp --verbose -I file --infinite TSFILES/Turksat_11133_V_1800_21_Oct_2023_RADIO-Only-TP--65Mbyte.ts  -O dektec --modulation DVB-S-QPSK --satellite-frequency 11133000000 --lnb 9750,10600,11700 --convolutional-rate 3/4 --symbol-rate 1800000 --roll-off 0.20 --pilots

No Audio stuttering, perfect playback on US3300 with RDK5.2.2

DVB-T/T2 - Playback of TS

I tried this on my AMDPC and it perfectly played & captured DVB-T stream simultaneously 13.Nov.2023

DVB-T Playback via DTU-315:

tsp --debug -I file /media/G550/PLAY.PL-TS-STREAMS/DVB-T_522_MUX3_4h.ts -O dektec --modulation DVB-T --frequency 634000000 --bandwidth 8 --guard-interval 1/8 --transmission-mode 8K

This plays very smoothly on AT301 without any issue. no flowing messages on dmesg.

DVB-T Capture via TBS5530:

tsp --debug -I dvb  --delivery-system DVB-T --guard-interval 1/8  --frequency 634000000 --bandwidth 8 --transmission-mode 8K > test.ts

Both showed exactly same bitrate:

  • Playback
* Debug: file: input: got bitrate 24,882,317 b/s
* Debug: file: input: got bitrate 24,882,316 b/s
* Debug: file: input: got bitrate 24,882,317 b/s
* Debug: file: input: got bitrate 24,882,317 b/s
  • Capture
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,317 b/s
* Debug: dvb: input: got bitrate 24,882,317 b/s

DVB-T Capture via TBS5530 detailed log:

stulluk ~ $  tsp --debug -I dvb  --delivery-system DVB-T --guard-interval 1/4  --frequency 634000000 --bandwidth 8 > test.ts
tsp: Debug: debug level set to 1
tsp: Debug: ====> tsp --debug
* Debug: debug level set to 1
* Debug: trying to load "/usr/bin/tsplugin_dvb.so"
..........
* Debug: registering input plugin "dvb", status: ok
* Debug: dvb: debug level set to 1
* Debug: dvb: ====> tsp -I dvb --delivery-system DVB-T --guard-interval 1/4 --frequency 634000000 --bandwidth 8
* Debug: file: debug level set to 1
* Debug: file: ====> tsp -O file 
* Debug: tsp: buffer size: 89,240 TS packets, 16,777,120 bytes
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/idVendor = "734c" (success)
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/idProduct = "5530" (success)
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/manufacturer = "TBS-Tech" (success)
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/product = "TBS 5530" (success)
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/version = "2.00" (success)
* Debug: dvb: /sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-2/1-2.2/dvb/dvb0.frontend0/device/serial = "" (failure)
* dvb: using /dev/dvb/adapter0 (DVB-T, DVB-T2, ATSC, ISDB-T, DVB-C, 2, DVB-C/C)
* Debug: loading names file /usr/share/tsduck/tsduck.dtv.names
* Debug: dvb: adding standards DVB to none
* Debug: dvb: starting discarding frontend events
* Debug: dvb: finished discarding frontend events
* Debug: dvb: tuning on /dev/dvb/adapter0/frontend0
* Debug: dvb: 1 DTVProperties:
* Debug: dvb: [0] cmd = 2 (DTV_CLEAR), data = 4294967295 (0xFFFFFFFF)
* Debug: dvb: tuning on /dev/dvb/adapter0/frontend0
* Debug: dvb: 11 DTVProperties:
* Debug: dvb: [0] cmd = 17 (DTV_DELIVERY_SYSTEM), data = 3 (0x00000003)
* Debug: dvb: [1] cmd = 3 (DTV_FREQUENCY), data = 634000000 (0x25CA1280)
* Debug: dvb: [2] cmd = 4 (DTV_MODULATION), data = 3 (0x00000003)
* Debug: dvb: [3] cmd = 6 (DTV_INVERSION), data = 2 (0x00000002)
* Debug: dvb: [4] cmd = 5 (DTV_BANDWIDTH_HZ), data = 8000000 (0x007A1200)
* Debug: dvb: [5] cmd = 36 (DTV_CODE_RATE_HP), data = 9 (0x00000009)
* Debug: dvb: [6] cmd = 37 (DTV_CODE_RATE_LP), data = 9 (0x00000009)
* Debug: dvb: [7] cmd = 39 (DTV_TRANSMISSION_MODE), data = 1 (0x00000001)
* Debug: dvb: [8] cmd = 38 (DTV_GUARD_INTERVAL), data = 3 (0x00000003)
* Debug: dvb: [9] cmd = 40 (DTV_HIERARCHY), data = 0 (0x00000000)
* Debug: dvb: [10] cmd = 1 (DTV_TUNE), data = 4294967295 (0xFFFFFFFF)
* dvb: tuned to transponder --delivery-system DVB-T --frequency 634,000,000 --modulation 64-QAM --high-priority-fec auto --low-priority-fec auto --bandwidth 8,000,000 --transmission-mode 8K --guard-interval 1/4 --hierarchy none
* Debug: dvb: starting tuner reception
* Debug: dvb: tuner reception started
* Debug: dvb: 6 DTVProperties (statistics result):
* Debug: dvb: [0] cmd = 62 (DTV_STAT_SIGNAL_STRENGTH), count = 2, stat = {scale: 1, value: -45100}, {scale: 2, value: 90}
* Debug: dvb: [1] cmd = 63 (DTV_STAT_CNR), count = 2, stat = {scale: 1, value: 38500}, {scale: 2, value: 91}
* Debug: dvb: [2] cmd = 66 (DTV_STAT_POST_ERROR_BIT_COUNT), count = 1, stat = {scale: 3, value: 0}
* Debug: dvb: [3] cmd = 67 (DTV_STAT_POST_TOTAL_BIT_COUNT), count = 1, stat = {scale: 3, value: 0}
* Debug: dvb: [4] cmd = 68 (DTV_STAT_ERROR_BLOCK_COUNT), count = 0, stat = 
* Debug: dvb: [5] cmd = 69 (DTV_STAT_TOTAL_BLOCK_COUNT), count = 0, stat = 
* dvb: locked: yes, strength: -45.1 dB, SNR: 38.5 dB
* Debug: dvb: initial buffer load: 44,620 packets, 8,388,560 bytes
* dvb: initial input bitrate is 24,882,315 b/s
* file: creating file 
* Debug: dvb: input thread started
* Debug: control commands: debug level set to 1
* Debug: file: output thread started
* Debug: control commands: debug level set to 1
* Debug: control commands: debug level set to 1
* Debug: control commands: debug level set to 1
* Debug: control commands: debug level set to 1
* Debug: control commands: debug level set to 1
* Debug: control commands: found 0 packet processor plugins
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,317 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,316 b/s
* Debug: dvb: input: got bitrate 24,882,317 b/s
* Debug: dvb: input: got bitrate 24,882,317 b/s
^C* tsp: user interrupt, terminating...
* Debug: aborting all plugins...
* Debug: aborting plugin dvb
* Debug: aborting plugin file
* Debug: file: stopping the output plugin
* Debug: file: output thread aborted after 769,920 packets (769,920 output)
* Debug: dvb: stopping the input plugin
* Debug: dvb: input thread aborted after 770,920 packets
* Debug: Report logging thread terminated
stulluk ~ $

DVB-T2 Playback

tsp --debug -I file /media/G550/PLAY.PL-TS-STREAMS/DVB-T_522_MUX3_4h.ts  --infinite  -O dektec --modulation DVB-T2 --frequency 522000000 --bandwidth 8 --fft-mode 32K --t2-guard-interval 1/128 --t2-l1-modulation 64-QAM --t2-fpsf 2 --pilot-pattern 7 --plp0-type 1 --plp0-modulation 256-QAM --plp0-code-rate 3/5 --plp0-fec-type 64K --papr NONE --miso OFF

or

tsp --debug -I file /media/G550/PLAY.PL-TS-STREAMS/PL_DVB-T2_2023-11-10_MUX2_538MHz.ts  --infinite  -O dektec --modulation DVB-T2 --frequency 538000000 --bandwidth 8 --fft-mode 32K --t2-guard-interval 19/256 --t2-fpsf 2 --pilot-pattern 4 --plp0-type 1 --plp0-modulation 256-QAM --plp0-code-rate 3/4 --plp0-fec-type 64K --papr NONE --miso OFF

Next Steps

I will provide more detailed commands for both DVB-T capture & playback: both for DVB-T and DVB-T2 modes.

DVB-T2 especially need more careful setting of cmdline parameters to exactly match the original modulation params, otherwise stuttering occurs during playback.



comments powered by Disqus