Transport Stream dataflow

Joker TV TS dataflow

Hello everybody! This post describes how Transport Stream dataflow within the Joker TV universal USB DTV receiver. All described functionalities are written on Verilog and run on Altera FPGA (EP4CE22F17C8N). The firmware is fully open source and can be found here.

I have also prepared the following diagram for a better understanding:

Transport Stream


As you can see, we have quite a few Transport Stream (TS) sources:

  • DVB-S2/T2/C2/ISDB-T demodulator (Sony CXD2854ER)
  • ATSC demodulator (LG LGDT3306A)
  • DTMB demodulator (AltoBeam ATBM8881)
  • Transport Stream generator – produces Transport Stream packets and fill them with a predefined pattern. This pattern can be used on the host’s side for data correctness control; written on Verilog.
  • USB EP4 – receive Transport Stream from host using USB bulk transfers. Can be used to pass data through Joker TV, for example for descrambling with CAM.

One of this source can be selected for further processing. This Transport Stream contains all packets without any filtration (Full TS). However for some reason, we need to exclude (strip) some Transport Stream packets. For example, full TS contains 10 TV programs but we only need one program. In this case Joker TV can pass packets that belongs only to this one program. This functionality is implemented inside the “TS PID filtering” block.

Then filtered Transport Stream can be passed to a CAM module (if present) for descrambling. In the final stage, TS is passed back to host using USB isochronous transfers. I have described this in a separate post here.

Transport Stream PID filtering example

Example, of Transport Stream PID filtering usage (you can pass multiple –program arguments to choose more than one program):

$ joker-tv -d 11 -f 575000000 -b 6000000 -m 7 --program 3 
selected program 3 
TS outfile:out.ts

This command is tuned to 575MHz ATSC (broadcasts NBC channel in Miami, FL) and save TS only for programs with the number 3. We can check this with following command:

$ ffmpeg -i out.ts

Input #0, mpegts, from 'out.ts':
 Duration: 00:00:03.49, start: 49891.352478, bitrate: 16393 kb/s
 Program 3 
 Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
 Stream #0:1[0x34](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
 Stream #0:2[0x35](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s

As you can see out.ts file contains only one program with one video PID 0x31 and two audio PID’s – 0x34 (English) and 0x35 (Spanish).


Joker TV is based on FPGA and has “endless” possibilities to implement any required functionality for TS processing. I’m open to discuss any proposals where possible.


5 thoughts on “Transport Stream dataflow

    • Abylay Ospan says:

      You should run following command:

      ffmpeg -i file.ts

      output will contains video, audio pid’s. Here is example output:

      Stream #0:0[0x144]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0:1[0x198]: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s
      Stream #0:2[0x199]: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s

  1. Gintaras says:

    Hello, it is possible to get somewhere a Chinese television ts dump, including EIT tables? It looks, that ts samples, uploaded to your server in 2018, doesn’t exists anymore. Maybe you have some? We develop an EPG project, and the samples from the entire world are required. Thank you so much.

Leave a Reply

Your email address will not be published. Required fields are marked *