DTMB capture

Task

Solved January 2018: Develop the systems needed to capture DTMB television broadcasts.

Related links

DTMB

DTMB is a major standard for digital broadcast.  It is used in China, Hong Kong, and Cuba and may be adopted in other nations. 
The GB20600-2006 standard described may just specify the transport stream format and not the digital layer, which is what we can process in software.

For information on DTMB hardware, see

Joker TV

A new initiative is the Joker TV device and drivers, see linux-kernel message, with support for DTMB and several other standards.
  1. Joker TV (2017) -- github
  2. https://tv.jokersys.com/
  3. Installation video at https://tv.jokersys.com/manuals/
  4. https://jokersys.com/2017/07/06/joker-tv-linuxosxwindows-drivers-apps/
  5. https://jokersys.com/2017/12/21/joker-tv-raspberry-pi-3/ 

How to download and build the driver

    Compile driver and apps from sources on Linux
    Install dependencies first (example for Ubuntu/Debian/Raspbian Linux)
    sudo apt install git cmake build-essential automake autoconf libtool pkg-config libudev-dev libxml2-dev
    then compile drivers and apps:
      git clone -b master --single-branch https://github.com/aospan/libjokertv --depth 1
             (or git clone https://github.com/aospan/libjokertv)
             cd libjokertv
             mkdir build
             cd build
             cmake ../
             make
    Or download the precompiled version to /mnt/HD1/software/.
    Symlink the executables and the library:
    ln -sf /usr/lib/ to /mnt/HD1/software/joker_tv-1.6.4-Linux/bin/joker-tv /usr/local/bin/
    ln -sf /usr/lib/ to /mnt/HD1/software/joker_tv-1.6.4-Linux/bin/tscheck /usr/local/bin/
    ln -sf /usr/lib/ to /mnt/HD1/software/joker_tv-1.6.4-Linux/bin/tsgen /usr/local/bin/ 
    ln -sf /usr/lib/ to /mnt/HD1/software/joker_tv-1.6.4-Linux/bin/i2c-scan /usr/local/bin/
    ln -sf /mnt/HD1/software/joker_tv-1.6.4-Linux/lib/libjokertv.so.1.6.4 /usr/lib/ ; ldconfig

Use the software

    joker-tv is the main application to interact with your Joker TV device. This application can start tuning and save the resulting Transport Stream to an output file.

    Example screenshot with tuning to ATSC
    Here is some help from joker-tv app:
    # ./joker-tv -h
    joker-tv usage:
    -d delsys Delivery system. Options:
    11-ATSC 5-DVB-S 1-DVB-C 3-DVB-T 16-DVB-T2 8-ISDB-T 13-DTMB
    -m modulation Modulation. Options:
    7-VSB8 (for ATSC) 0-AUTO
    -f freq Frequency in Hz. Example: 1402000000
    -s symbol_rate Symbol rate. Options: 0-AUTO. Example: 20000000
    -b bandwidth Bandwidth in Hz. Example: 8000000
    -o filename Output TS filename. Default: out.ts
    -t Enable TS generator. Default: disabled
    -n Disable TS data processing. Default: enabled
    -u level Libusb verbose level (0 - less, 4 - more verbose). Default: 0
    -w filename Update firmware on flash. Default: none
    Tune to DVB-C on 150MHz with bandwidth 8MHz
    ./joker-tv -d 1 -f 150000000 -b 8000000
    Tune to ATSC on 575MHz with bandwidth 6MHz and modulation 8VSB
    ./joker-tv -d 11 -f 575000000 -b 6000000 -m 7
    Tune to DVB-T on 650MHz with bandwidth 8MHz
    ./joker-tv -d 3 -f 650000000 -b 8000000
    Tune to ISDB-T on 473MHz with bandwidth 6MHz
    ./joker-tv -d 8 -f 473000000 -b 6000000
    Tune to DTMB on 650MHz
    ./joker-tv -d 13 -f 650000000
    TS stream generator
    FPGA firmware has built-in TS stream generator. Generated TS has specially prepared content with predefined pattern, so we can check data correctness on the host’s side. To activate the TS generator use following command:
    ./joker-tv -t
    generated TS will be saved into ‘out.ts’ file. Check the TS stream correctness with following command:
    ./tscheck -f out.ts -p


More joker-tv tips:
    There is console app 'joker-tv' comes with: https://github.com/aospan/libjokertv. No GUI or X server required !
    joker-tv can capture full TS.
    See libjokertv.so library ( https://github.com/aospan/libjokertv ) and console app. Can be used to record any stream or modified to specific requirements.
    Lock instructions can be given to xml file:
    ./build/joker-tv
           --in in.xml     XML file with lock instructions. Example: --in ./docs/atsc_north_america_freq.xml 
            --out out.csv   output CSV file with lock results (BER, etc). Example: --out ant1-result.csv 
    Use the supplied xml files (in docs/ dir) or build your own.
    Save TS file with '-o' option.
    Limit (MB) with option '-l'.
    Scheduling not yet implemented on joker-tv.

Linux support

DVEO provides a Linux SDK for their 
TVB593 DTMB capture card; for Red Hen Lab, a LAN-based tuner like HDHomeRun or a USB tuner would be preferable to a PCIe capture card.

Linux driver development
  1. CTTB driver patch (linux-media 2011, Mauro Carvalho Chehab)
  2. DTMB support for DVB API (linux-media 2012, Antti Palosaari)
  3. Better document DTMB time interleaving (linuxtv 2015, Mauro Carvalho Chehab)
  4. Submit bug reports for DTMB to linux-media@vger.kernel.org -- subscribe and archive
Linux Kernel developer Antti Palosaari <crope@iki.fi> has written some basic DTMB support into the Linux kernel, see blog entry. He also wrote a HDIC HD29L2 DTMB (aka CMMB or DMB-T/H) demodulator driver (hd29l2) for kernel 3.3, but notes there is no longer any public hardware for that driver.

For discussion (in Chinese) of Linux in Hong Kong and China, see
  1. HKEPC Forum (Hong Kong)

Android support

Several devices appear to be supported in Android:

Text extraction

CCextractor probably does not yet handle DTMB text extraction -- we don't have any samples yet to test.

The HKCA1108.pdf regulatory document from the Hong Kong government states that "Receivers shall include provisions to decode and display subtitles conforming to ETSI EN 300 743." This is the specification that regulates European subtitles over DVB. It's possible that DTMB regulates only the physical signal but has nothing to do with subtitles or video encoding.

Similarly this Test Procedure document from the Cuban government says "The TV Set is intended for the reception of DTMB Digital Terrestrial Television in 6MHz bandwidth, according to the specifications GB 20600-2006 and DVB subtitles (ETSI EN 300 743). The DUT must support DVB subtitles (ETSI EN 300 743)."

Next Steps

  1. Get some recordings of broadcast streams—not examples from the web, which do not include digital closed captions.
  2. Get the technical specifications documents on the DTMB standard that would be needed by CCextractor staff to add support for DTMB.