Saturday, 25 April 2015

Decrypting service in DVBStreamExplorer using CI capable hardware

A little known feature in DVBStreamExplorer is the ability to decrypt DVB services using hardware that supports common interface (CI). You will need a TechnoTrend tuner card with CI support. This includes devices such as TT-connect CT 3650 CI and TT-connect S2 3650 CI. TT Budget cards with CI add-on card will also work. Cards with CI option from manufactures other than TechnoTrend will not work. Also this will only work with DVBStreamExplorer x86 version. CI and DiSEqC features are implemented in a proprietary DLL from TechnoTrend, ttBdaDrvApi_Dll.dll. Apparently this DLL is only available in 32 bit version.
You will also need a conditional access module (CAM) and a valid subscription smart-card. See picture below. It shows TT-connect CT 3650 CI, Conax CAM and subscription smart-card.




Insert your CAM and do a SI scan in DVBStreamExplorer. When completed switch to service view and DVBStreamExplorer should look similar to below.


Note that in lower right corner it can be seen that no service is currently selected.
To select a service for decryption locate an encrypted service in service view and double-click on it.
Lower right corner will now show that a service has been successfully selected.



Note this does not necessarily mean that service will be decrypted successfully. It just mean that tuning and selection of service was executed successfully.

You can check the DVBStreamExplorer log file for CI related entries. The log file can be found from options / preferences / logging.

Here is some logging from when CAM was inserted and initialized. The CA ID 0xb00 is for Conax.
 213 - Apr 25 09:25:51.189 - (9.842) - <4> - CI_OnSlotStatus(0,1)
 214 - Apr 25 09:25:51.189 - (9.842) - <4> - CI_SLOT_MODULE_INSERTED
 215 - Apr 25 09:25:57. 63 - (15.716) - <4> - CI_OnSlotStatus(0,2)
 216 - Apr 25 09:25:57. 63 - (15.716) - <4> - CI_SLOT_MODULE_OK
 217 - Apr 25 09:25:57. 63 - (15.716) - <4> - CI_SLOT_CA_OK
 218 - Apr 25 09:25:57. 63 - (15.716) - <4> - CA:  219 - Apr 25 09:25:57. 63 - (15.716) - <4> - supported CA ID[0]: 0x0B00

And here is some logging from when a service was selected for decryption.
1222 - Apr 25 12:10:11.524 - (9870.177) - <4> - Selecting service 'Discovery Channel'
1223 - Apr 25 12:10:11.623 - (9870.276) - <4> - CI_OnCAStatus(255,14,0)
1224 - Apr 25 12:10:11.623 - (9870.276) - <4> - CI_SWITCH_PRG_REPLY
1225 - Apr 25 12:10:11.623 - (9870.276) - <4> - ERR_NONE

Again this does not not necessarily mean that service will be decrypted successfully. It just means that connection to CAM is in good state.

To check that service is actually decrypted open DVB TS Monitor. Make sure that "Options / Parse A/V elementary headers" is enabled. Start the scan. In current service tab, services node locate the service selected for decryption. Verify that it looks something like below.



If you see details about A/V streams as tagged above, it means that service is successfully decrypted. That is unless the service was not encrypted at all to begin with. Note that it can take up to a minute or in rare cases even more for the header details to appear. This is because each stream in TS is scanned one by one for some time looking for header information.

Once decryption is verified you can save TS to disk. You can then view decrypted service in VLC. You can also stream service over UDP. Other clients can then pick up the decrypted service.


Sunday, 15 February 2015

Capture HbbTV data with DVBStreamExplorer

In this post I will demonstrate how you can capture HbbTV data using DVBStreamExplorer. You will need DVBStreamExplorer Professional Edition for this exercise.
You can then study the HbbTV application offline. You can find more information about HbbTV here: https://www.hbbtv.org/.
First we need to find a service that contains HbbTV application. In this example I will find a service on Astra 19E.
You can find such service in this list: http://dtvlist.dvbstreamexplorer.com/dvbs.html. Look for 'hbbtv' in feature field.
Or you can do a complete SI scan of Astra 19E with DVBStreamExplorer. After completing SI scan switch to service view and you should see something similar to below.


Scroll to the far right to see features field and look for 'hbbtv'.


It can be seem that first service in the list, ORF SPORT+, features HbbTV.
Open the tuning window and tune on 11244H where the ORF SPORT+ service can be found.
Open Transport Stream Monitor (DVB) and start scanning. After a few seconds of scanning you should be able to select ORF SPORT+ from service drop-down list.


Now go to the DSM-CC tab. You should see list of DSM-CC streams found in service. For ORF SPORT+ there will only be one on PID 0x1c2b. Enable scanning of the PID in list.


It will now scan for DSM-CC data. This may take a short while. Once all DSM-CC data has been acquired the Object Carousel tab will be populated with file/folder structure. The content of files will also be shown as ASCII/Hex. Below can be seen partly content of a CSS file named min_portal_1_0_6.css which is part of HbbTV application.


And below is shown content of min_config_1_0_6.js which is a JavaScript file also part of HbbTV application.


Finally below shows partial content of index.html which is a HTML file also part of HbbTV application.


You can now stop scanning to enable file menu. From here the entire Object Carousel be saved. Directory structure in OC is preserved when saved to file system. You can now open the files in your favourite text editor for further examination.

Monday, 20 October 2014

DVBStreamExplorer service XML files

Introduction

DVBStreamExplorer has the feature to save service information as XML files. This can either be done explicitly from File->Export->XML menu, or it can be saved automatically on completion of a multiple MUX scanning session.
The folder where to save automatically can be set on Options->preferences menu on SI Scan tab.



The XML file contains information about all the services found during SI scan by analysing PAT, PMT, NIT, SDT and NIT tables. Post processing this XML file can have many useful applications.
In this post I will be demonstrate how to read the service XML file and post content to a web service encoded in JSON. For instance this could be used to feed an on-line web application with service data.

Service

Information about one service is stored in one XML element.
An example of a service XML element is shown below.

<service position="Astra 19.2°E" frequency="11303" polarity="H" symbolrate="22000" fec="2/3" modulation_system="1" modulation_type="2" roll_off="0" name="ORF1 HD" provider="ORF" network_type="dvbs" network_name="ASTRA 1" onid="1" nid="1" tsid="1007" sid="4911" pmt="107" pcr="1920" type="25" free_ca_mode="1" lcn="-1">
  <ca_list>
    <ca CA_system_ID="3333" CA_PID="220" private_bytes=""/>
    <ca CA_system_ID="3477" CA_PID="270" private_bytes=""/>
    <ca CA_system_ID="1608" CA_PID="120" private_bytes=""/>
    <ca CA_system_ID="5890" CA_PID="320" private_bytes=""/>
    <ca CA_system_ID="6195" CA_PID="420" private_bytes=""/>
    <ca CA_system_ID="2500" CA_PID="480" private_bytes=""/>
    <ca CA_system_ID="2444" CA_PID="490" private_bytes=""/>
    <ca CA_system_ID="3480" CA_PID="272" private_bytes=""/>
    <ca CA_system_ID="1616" CA_PID="122" private_bytes=""/>
  </ca_list>
  <streams>
    <stream type="27" pid="1920" type2="14496-10">
      <ca_list/>
    </stream>
    <stream type="4" pid="1921" language="ger" type2="13818-3">
      <ca_list/>
    </stream>
    <stream type="4" pid="1922" language="eng" type2="13818-3">
      <ca_list/>
    </stream>
    <stream type="6" pid="1923" language="ger" type2="ac3">
      <ca_list/>
    </stream>
    <stream type="6" pid="1925" type2="teletext">
      <ca_list/>
    </stream>
    <stream type="5" pid="7310" application_name="ORF HbbTV - SAT HD" type2="hbbtv">
      <ca_list/>
    </stream>
    <stream type="11" pid="7311" type2="data">
      <ca_list/>
    </stream>
  </streams>
</service>
As it can be seen there is quite some information. This includes properties like name, provider, tuner parameters, NID/ONID/TSID/SID and more. It also includes CA information, both from first loop of descriptors and the loop for each stream.
Each stream contains a type field which is simply the stream_type field from PMT. It contains a type2 field. The value is decided after analysing of stream_type field and certain descriptors. Besides benefaction of various audio and video streams this will also identify certain features and applications such as teletext, subtitle, mhp, hbbtv and more.

Client application

The client application is a .NET application written in C#. Source code is available from here https://dvbseserviceproc.codeplex.com/
It will allow you to select service XML file; network type; web service URL and method. After applying 'Process' service content will be sent to specified URL encoded in JSON.
You can modify the application for your specific needs if this will not work for you.



Server application

PHP

The server application is a simple PHP script that will consume the JSON data posted by client application. It will validate the presence of  a few expected properties, name and provider. Other than that it won't do anything with the data. In a real world application one might want to do stuff like saving the service data to a database.
The PHP script can be found below and can me modified for your specific needs. It was tested on a basic Apache running on Linux.

Google App Engine

There is is a live test web-service here http://dvbseserviceapi.appspot.com running on Google App Engine. Source code for web application is available here https://code.google.com/p/appengine-dvbseserviceapi/

Conclusion

This was just an minimum example to get you started. It doesn't really do anything useful as is. But it does show the potential of post processing service XML file.

Sunday, 11 May 2014

H.262 usage reports in CSV format in TS File Demux 2.2.13

The latest version of TS File Demux introduces a new feature whereby extended reports about H.262 usage can be created in CSV format. The new feature is available as an option for all ES filters.
One report, h262report.csv, includes count of all picture_start_code, slice_start_code, user_data_start_code, sequence_header_code, sequence_error_code, extension_start_code, sequence_end_code and  group_start_code packets for all selected ES filters where H.262 report feature is enabled.
An example of such file is shown below. Document can also be opened directly in Google Drive here: https://docs.google.com/spreadsheets/d/1Qb7g-47NG9_kVpstgWGsyaUb0Gp9VeWNGU5-rgVzK64/edit?usp=sharing



Then for each selected ES filter where H.262 report feature is enabled a CSV file will be created listing all H.262 packets in order of occurrence.
An example of such file can open document directly in Google Drive from link below. The file is too large to be shown in-line.
https://docs.google.com/spreadsheets/d/1WaZNhbynCfofZ8AY_f4oUUs1YxBqkyDYHauzh4ALa2s/edit?usp=sharing



Thursday, 6 February 2014

Discover section table_id with TS File Demux

When processing a TS file with TS File Demux a file named sectionreport.csv is created in output directory. This file contains various statistics about sections found in stream. Starting from TS File Demux V2.2.11 a new field, table_id, has been added to this file. This field contains a list of unique table_id's found in section stream. Sometimes this information can be useful, especially for streams containing multiple types of tables.
Below is an example of sectionreport.csv file after processing a DVB TS file.



It can be seen that PID 17 (0x11) contains SDT actual transport stream (0x42) and SDT other transport stream (0x46) tables.
PID 18 (0x12) contains various types of EIT tables.
PID 20 (0x14) contains TDT and TOT tables.
PID 48 (0x40) is a CA EMM stream containing table_id's 0x82 and 0x84 tables.
PID 102 (0x66) is a CA ECM stream containing table_id's 0x80 and 0x81 tables.
PID 8001 (0x1f41) contains a DSM-CC carousel. Table_id 0x3b is userNetworkMessage and table_id 0x3c is downloadDataMessage.

You can open the sample sheet here https://docs.google.com/spreadsheet/ccc?key=0AlzKD8F--RuTdDNrUFpSY0lMWkpxWG1lTTJZaUotTnc&usp=sharing


Tuesday, 23 July 2013

Decoding of DSM-CC BIOP messages

DVBStreamExplorer V4.0.3 has just been released. Now with DSMC-CC BIOP message decoding in DVB TS Monitor (professional edition only).
Until now DSM-CC analyser would show raw data of Data Carousel modules in one tab and the Object Carousel file system hierarchy in another tab. Starting from DVBStreamExplorer V4.0.3 decoding of BIOP messages is now shown for each module in Data Carousel. The information in BIOP messages is used to build the file system in Object Carousel.

In screenshot below is shown decoding of Service Gateway.



In screenshot below is shown decoding of a file object.

Sunday, 23 June 2013

DVBStreamExplorer WS export online test service

If you have ever wanted to test DVBStreamExplorer export to WS features but gave up because of the hassle of creating a web service, then check out http://www.jensvaaben.com/dvbsewstest/.
It will allow you to export directly from DVBStreamExplorer to a live web service. Afterwards you can view the data that you have exported. Detailed instructions on http://www.jensvaaben.com/dvbsewstest/.