HbbTV : Creating a test broadcast feed

France Televisions has been involved in HbbTV since 2010, and our frontend developers learned its limitations "the hard way" over the past 5 years. In the previous post we discussed the main bugs and limitations we encountered on real TV sets. In this post we will discuss how to create a test video feed to test an HbbTV App.

To test an HbbTV broadcast app you need to have access to a DVB-T feed that contains a reference to your app, hosted on a webserver. Unless you are a broadcaster, it is unlikely you will be able to create a real production stream so let's learn how to create a test stream.

Using VLC

To create a stream from DVB-T:

  1. Connect a DVB-T reception dongle on your PC
  2. Launch VLC and select the appropriate capture device
  3. Once playback has started, go to the File menu and select convert/save
  4. Select the capture device and select the same options as before.
  5. Click the bottom of the window on Convert / Save
  6. Then select "Save raw stream"
  7. Wait as long as you want to have the video loop for you.

Using Open Caster

Installing OpenCaster

OpenCaster is a comprehensive DVB toolbox that allows among other thins to generate broadcast feeds that embed HbbTV contents. (Works entirely from the command line. / Free and Open Source / runs on Linux).

  1. Download OpenCaster http://www.vlp.com/the-key-vlues/15-free-software/33-opencaster
  2. Installation:
    1. Decompress the archive OpenCaster.2.4.tgz (tar -xvzf OpenCaster.2.4.tgz)
    2. Edit the file Descriptors.py in the folder "libs/dvbobjects/dvbobjects/MHP" and add the following lines:
class simple_appliction_location_descriptor(Descriptor):
  descriptor_tag = 0x15
  def bytes(self):
    fmt = "!%ds" % len(self.initial_path)
    return pck(fmt, self.initial_path)

3. Navigate to the directory OpenCaster2.4

cd OpenCaster2.4

4. Compile and install OpenCaster tools (see root privileges to "make install")

make
make install

Configure DVB tables

The configuration of DVB tables is done in a python script.
The tables are PT, PMT, SDT, NIT and AIT.
For the generation of tables, just run the script:

./my_script_python.py

The script takes care of generating the tables in the form of transport stream files (.ts) for each table.
Be careful to change the appropriate settings for each channel in the constant declaration (ftv_service_id, ftv_service_name, ftv_it_pid), for example in France:

France 2 : ftv_service_id = 257 / ftv_service_name = France 2 / ftv_it_pid = 2002
France 3 : ftv_service_id = 258 / ftv_service_name = France 3 / ftv_it_pid = 2003
France 2 : ftv_service_id = 259 / ftv_service_name = France 5 / ftv_it_pid = 2005

To update the url of the HbbTV application, it is required to update in the AIT (in the Python script) the URL_base variable (root of the called URL) and initial_path (url path).

It is also possible to update the name of the application by updating the application_name variable.

Typical python script

Multiplexing video files

To multiplex one or several video files with different tables we will use the DVB software "tscbrmuxer" by OpenCaster.
There are two different ways to retrieve the result. Either through a file or in a "FIFO".
If you choose a file, "tscbrmuxer" will fill it until the program is cut (ctrl + c) or the disk space is full. The interest of the "FIFO" approach is that the muxer can rotate continuously without filling up disk space.

Usage example:

mkfifo fifomuxed.ts

File muxing requires the assignment of a "bitrate" for each of the .ts files, they are written in the form b: bitrate_number.

If you do not know the bitrate of a file you have several ways to know it.
Either using TSReder (usingWindows) or using tsprcmesure command (tool provided with OpenCaster).

Usage example:

tspcrmesure video1.ts supposed_bitrate_value

Steps to follow:

  1. Get a TS file that will be used as a broadcast feed.
  2. Know the bitrate of this file using the command tspcrmesuretspcrmesure video1.ts 2000
  3. Muxing using the tscbrmuxer command

tscbrmuxer b: 50000000 video1.ts b: 2000 it.ts b: 1500 nit.ts b: 3000 pt.ts b: 3000 pmt1.ts b: 1500 sdt.ts b: 2470000 null.ts> muxedvideo.ts

---------------------------------------------

Cette section vise à présenter comment créer un flux de test pour tester une application HbbTV

Via VLC

Pour créer un flux à partir de la TNT

  1. Brancher une clé TNT sur votre PC
  2. Lancer VLC en choisissant le périphérique de capture approprié
  3. Une fois la lecture en cours allez dans le menu Fichier => Convertir / Enregistrer
  4. Sélectionner le périphérique de capture et choisissez les mêmes options qu'avant.
  5. Cliquer en bas de la fenêtre sur Convertir/Enregistrer
  6. Puis cocher "Enregistrer le flux brut"
  7. Attendez le temps que vous souhaitez pour avoir la boucle vidéo qui vous convient.

Vous pouvez très bien brancher un câble TNT en provenance des chaines de tests pour enregistrer le signal de test, ou autre.

Via Open Caster

Installation de OpenCaster

Véritable boite à outils DVB très complète qui permet notamment de générer des flux brodcast avec du HbbTV dedans. (Fonctionne entièrement en ligne de commande. / Gratuit et OpenSource / Tourne sous Linux)

1 - Télécharger OpenCaster http://www.vlp.com/the-key-vlues/15-free-software/33-opencaster

2 - Installation :

2.1 Décompresser l'archive OpenCaster.2.4.tgz
tar -xvzf OpenCaster.2.4.tgz

2.2 Modifier le fichier Descriptors.py dans le dossier "libs/dvbobjects/dvbobjects/MHP"

Et lui rajouter les lignes suivantes :

class simple_appliction_location_descriptor(Descriptor):
  descriptor_tag = 0x15
  def bytes(self):
    fmt = "!%ds" % len(self.initial_path)
    return pck(fmt, self.initial_path)

2.3 aller dans le répertoire OpenCaster2.4

cd OpenCaster2.4
2.4 Compiler et installer les outils OpenCaster (avoir les droits root pour « make install »)

make
make install

Configuration des tables DVB

La configuration des tables DVB se fait dans un script python.
Les tables sont PT, PMT, SDT, NIT et IT.
Pour la génération de tables, il suffit d'exécuter le script :
./mon_script_python.py
Le script s'occupe de générer les tables sous la forme de fichier transport stream (.ts) pour
chaque table.
Il faut faire attention à changer les paramètres adéquats pour chaque chaîne dans la déclaration des constantes (ftv_service_id, ftv_service_nme, ftv_it_pid )

France 2 : ftv_service_id = 257 / ftv_service_name = France 2 / ftv_it_pid = 2002
France 3 : ftv_service_id = 258 / ftv_service_name = France 3 / ftv_it_pid = 2003
France 2 : ftv_service_id = 259 / ftv_service_name = France 5 / ftv_it_pid = 2005

Pour changer l'url de l'appliction, il faut modifier dans l'IT (Toujours dans le script Python) les varaibles URL_base (base de l'url appelée) et initil_pth (reste de l'url appelée).
On peut également changer le nom de l’application en modifiant l variable appliction_name.

fichiertype.py 

Multiplexage de fichiers vidéo

Pour multiplexer le ou les fichiers vidéo avec les différentes tables DVB nous utiliserons le programme « tscbrmuxer » fournit par OpenCaster.
Il existe deux manières différentes pour récupérer le résultat. Soit dans un fichier, soit dans une « fifo ».
Si vous choisissez un fichier, « tscbrmuxer » le remplir jusqu'à  ce que le programme soit coupé (ctrl+c) ou que l'esapce disque soit rempli. L’intérêt de la « fifo » est que le muxer peut tourner en continue sans remplir l'espace disque.

Exemple d’utilisation :
mkfifo fifomuxed.ts

Le muxage des fichiers nécessite l'attribution d'un « bitrate » pour chacun des fichiers .ts, ils s'écrivent sous la forme b:nombre_du_bitrate.

Si vous ne connaissez ps le bitrate d'un fichier vous avez plusieurs manière de la connaitre.
Soit en utilisant TSReder (sous windows). Soit en utilisant la commande tsprcmesure (outil fournit avec OpenCaster).

Exemple d’utilisation :
tspcrmesure video1.ts supposition_valeur_du_bitrate

Etapes à suivre :

1 - voir un fichier TS qui va faire office de broadacst.
2 - Connaître le bitrate de ce fichier grâce à  la commande tspcrmesure. (ex : tspcrmesure video1.ts 2000)
3 - Muxage avec la commande tscbrmuxer (ex : tscbrmuxer b:50000000 video1.ts b:2000 it.ts b:1500 nit.ts b:3000 pt.ts b:3000 pmt1.ts b:1500 sdt.ts b:2470000 null.ts > muxedvideo.ts)

 

Posted by Florian / Categories : hbbtv