Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1341 closed enhancement (fixed)

UK Interactive TV

Reported by: dm@… Owned by: danielk
Priority: minor Milestone: 0.20
Component: dvb Version: head
Severity: low Keywords:
Cc: Ticket locked: no


This patch contains the code for interactive TV in the UK and includes an MHEG interpreter and DSMCC object carousel. There is a tar archive with the new files and a patch file with all the changes. The patch was prepared against SVN release 8998 and may not apply properly to other versions.

It requires the mpeg2dec library (mpeg2dec-devel in Fedora Core or libmpeg2-4-dev in Debian). UK MHEG uses MPEG I-frames for some still images and I couldn't easily see how to use ffmpeg to convert them to QImage.

The code uses F2, F3, F4, F5, F6 and T for the Red, Green, Yellow, Blue, Exit and Text keys respectively.

It basically does everything that a set-top-box does. The major outstanding issue is that some of the "teletext" screens are supposed to show a reduced scale video in a box alongside the text. Scaling doesn't currently work and it just shows a portion of the screen.

This is probably only of immediate use in the UK but the DSMCC code could be used with an MHP engine in the rest of the world.

David Matthews.

Attachments (6)

interactivetv.files.tgz (112.5 KB) - added by anonymous 15 years ago.
interactivetv.patch.gz (15.5 KB) - added by anonymous 15 years ago.
interactive2.files.tgz (109.9 KB) - added by dm@… 15 years ago.
Updated archive of additional files
interactive2.patch.gz (14.9 KB) - added by dm@… 15 years ago.
Updated patches
MHEG (23.4 KB) - added by chris [@… 15 years ago. (23.4 KB) - added by chris [@… 15 years ago.

Download all attachments as: .zip

Change History (33)

Changed 15 years ago by anonymous

Attachment: interactivetv.files.tgz added

Changed 15 years ago by anonymous

Attachment: interactivetv.patch.gz added

comment:1 Changed 15 years ago by danielk

Component: mythtvdvb
Milestone: 0.20
Version: head

comment:2 Changed 15 years ago by dm@…

When I created this ticket I got an error message from TRAC saying "database locked" and giving a Python backtrace. It seems to have created the ticket but I haven't seen a corresponding message in mythtv-commits.

Just to reiterate for anyone in the UK who wants to try it: this patch contains an MHEG interpreter, DSMCC and associated glue for UK interactive TV.

comment:3 Changed 15 years ago by danielk

dm, can you update this patch to apply to the latest SVN?

BTW to generate a QImage have a look at NuppelVideoPlayer::GetARGBFrame(). You just keep the player going and call that whenever you want an image.

You can also use NVP::GetScaledFrame?() to get the YUV version of the frame, this is significantly faster since it skips the YUV->RGB conversion.

comment:4 Changed 15 years ago by John Pullan <john.pullan@…>

as an aside :

  • This patch displays the radio channels logos
  • It also displays the appropriate channel off the air screen

both of these are good things :)

Changed 15 years ago by dm@…

Attachment: interactive2.files.tgz added

Updated archive of additional files

Changed 15 years ago by dm@…

Attachment: interactive2.patch.gz added

Updated patches

comment:5 Changed 15 years ago by dm@…

I've added updated versions of the patches and the additional files for the DSMCC/MHEG code. This was done against SVN 9309 so is pretty well up to date. It now uses the ffmpeg library to convert still images sent as MPEG I-frames so the mpeg2dec library is no longer required. I made a few changes to the DSMCC carousel code and the layout of the code has been changed to be more in keeping with the rest of Myth. Otherwise it's largely unchanged.


comment:6 Changed 15 years ago by danielk

(In [9314]) References #1341. Portion of DSMCC/MHEG patch from David Matthews.

This adds the DSMCC stream type and parses out some info for it out of the PMT table.

This also fixes a long standing problem with the mpegts parser not understanding multiple PES packets in a TS packets. MythTV does not generate such streams, but this fix allows you to watch some raw stream captures in mythtv which mplayer can't decode.

comment:7 Changed 15 years ago by danielk

(In [9315]) References #1341. Adds dsmcc and mheg debugging types.

comment:8 Changed 15 years ago by danielk

(In [9316]) References #1341. Bulk of Dave Matthews' MHEG implementation.

The MythTV hooks will be added seperately and in steps so that any problems can be isolated to a changeset.

MHEG is a type of Interactive TV used in DVB countries. It includes such things as an enhanced channel guide, access to additional video streams, and games. So far the implementation only contains support for the UK profile.

comment:9 Changed 15 years ago by danielk

(In [9317]) References #1341. Add svn:ignore properties for libfreemheg dir, remove generated file

comment:10 Changed 15 years ago by anonymous

Just so I and others know, what is involved/where does someone start in creating a profile/engine for another country?

comment:11 Changed 15 years ago by danielk

(In [9425]) References #1341. Portion of patch pertaining to dvbrecorder.

This fixes some problems with the fake video generation worked out for the DVB Radio patch, so that it works for MHEG.

comment:12 Changed 15 years ago by danielk

(In [9426]) References #1341, 25FPS PAL dummy stream for DVB Radio.

comment:13 Changed 15 years ago by danielk

(In [9442]) References #1341. Adds in DSMCC portion of David's patch.

comment:14 Changed 15 years ago by danielk

(In [9443]) References #1341. Adds MHEG engine code. (doesn't enable mheg yet)

comment:15 Changed 15 years ago by danielk

(In [9444]) References #1341. Missing delete in [9426].

comment:16 Changed 15 years ago by danielk

(In [9447]) References #1341. Remainder of ITV patch.

This still does not provide a means for viewing the interactive TV UI, but all the code is in now. All that is needed is a means of toggling this new functionality on.

comment:17 Changed 15 years ago by Stuart Auchterlonie

We need to provide an option to not record the interactive data streams when making a recording.

I've just transcoded a stream which contained 1 video, 1 audio, 1 subtitle and 4 data streams down to just 1 video & 1 audio stream. This was a straight mpeg-mpeg trancode so it amounts to dropping unwanted streams and a few short ad breaks. The file size has dropped from 4.9Gb to 2.8Gb.

The tallies up with what I found when I initially investigated interactive tv support, that the recorded file sizes increase by about 30% on average when you record the interactive streams data streams as well. These streams only make sense for 'live tv'

comment:18 Changed 15 years ago by anonymous

wrt to file sizes, all that is needed is a recording profile option for 'data services'. Then the DVB Recorder should be modified to record only A/V and subtitle streams if this option is not enabled, and the dvbsignalmonitor should enforce a audio pid requirement when the option is not enabled.

I disagree that these streams should only be recorded in LiveTV mode, but you could easily achieve this effect by only checking this 'data services' option in the LiveTV profile.

comment:19 Changed 15 years ago by chris [@…


I've found a bug with the interactive TV code. Using 9457, when I tune in Live TV to a channel that uses MHEG (any BBC or ITV, although Channel 4 seems ok) the frontend will segfault. The same thing happens with recordings. I tried watching a recording from BBC2 that is a couple of months old which had the problem. I reverted back to 9442 and all is well. I've attached a gdb backtrace, and the output of -v all,nodatabase


Changed 15 years ago by chris [@…

Attachment: MHEG added

Changed 15 years ago by chris [@…

Attachment: added

comment:20 Changed 15 years ago by chris [@…


I can confirm commit 9443 causes the segfault in the front end whilst watching Live TV. (BBC1)


comment:21 Changed 15 years ago by danielk

(In [9461]) References #1341, a few fixes to the MHEG code from David Matthews.

comment:22 Changed 15 years ago by dm@…

Chris's backtrace looks like the problem I had which should be fixed with the patches in 9461. David.

comment:23 Changed 15 years ago by chris [@…

Yep, I can confirm 9461 fixes the crashes I was having with 9443.

Well spotted David... Wish I could actually program in C :-)


comment:24 Changed 15 years ago by danielk

Resolution: fixed
Status: newclosed

comment:25 Changed 15 years ago by andrewd.lists@…

Resolution: fixed
Status: closedreopened

In [9314] STREAM_TYPE_PRIVATE_DATA was added to is_desired_stream(), and these streams are handled in the default: of init_stream(). However this means that unknown private streams are tagged as

 codec_type = CODEC_TYPE_VIDEO;
 codec_id = CODEC_ID_MPEG1VIDEO;

This causes problems with MPEG2FIX as the stream is definately not MPEG1VIDEO (see #2007). May also cause the bad transcoding to MPEG4 I've seen from the same channel (ABC, Melbourne, Australia).

Some info from playback of one of these files:

mpegts_add_stream: at pid 0x200 with type 2
mpegts_add_stream: stream #0, has id 0x200 and codec MPEG2VIDEO, type Video at 0x89cfca0
mpegts_add_stream: at pid 0x28a with type 4
mpegts_add_stream: stream #1, has id 0x28a and codec MP3, type Audio at 0x89d74f0
mpegts_add_stream: at pid 0x294 with type 129
mpegts_add_stream: stream #2, has id 0x294 and codec AC3, type Audio at 0x89cc600
mpegts_add_stream: at pid 0x240 with type 257
mpegts_add_stream: stream #3, has id 0x240 and codec DVB_VBI, type Data at 0x89da690
mpegts_add_stream: at pid 0x17c0 with type 6
mpegts_add_stream: stream #4, has id 0x17c0 and codec MPEG1VIDEO, type Video at 0x89cceb0
Input #0, mpegts, from '/mnt/myth/video/1018_20060630202800.mpg':
  Duration: 01:46:51.5, start: 84116.692611, bitrate: 6970 kb/s
  Stream #0.0[0x200], 1/90000, 25.00 fps(r): Video: mpeg2video, yuv420p, 720x576, 1/25, 15000 kb/s
  Stream #0.1[0x28a](eng), 1/90000: Audio: mp2, 48000 Hz, stereo, 256 kb/s
  Stream #0.2[0x294](eng), 1/90000: Audio: ac3, 48000 Hz, stereo, 448 kb/s
  Stream #0.3[0x240](eng), 1/90000: Data: 0x0000
  Stream #0.4[0x17c0], 1/90000, 90000.00 fps(r): Video: mpeg2video

The hack to work around this for new recording is probably to comment out STREAM_TYPE_PRIVATE_DATA in is_desired_stream(), but I'm not sure what the correct fix is, maybe something like

comment:26 Changed 15 years ago by danielk

Resolution: fixed
Status: reopenedclosed

Andrew, there is a setting in the recording profiles that allows you to record only the TV streams and ignore the ITV. i.e. there is already an implementation of the hack available.

The MPEG1VIDEO fallback problem should be fixed, but ticket #2007 is the right place to track that.

comment:27 Changed 15 years ago by pen.dev01@…

It may in some circumstances be 'attractive' to be able to record the MHEG data during an interactive program. I believe that Sky were thinking of providing this. Probably requires a lot of thought about how it is implemented and / or configured.

Thank you for this work! I know how much effort is involved. I managed to convert a Java MHEG engine to C# with a view to adding it to (dare I mention?!) MediaPortal?. I managed to display files from the hard disk, but couldn't find any information about exactly how the MHEG data was encoded in a transmission! Having only just managed to get MythTV up and running (via Suse 10.1) from binaries, I'm keen to have another go at installing from source to see your efforts! (I really would love to see a decent Windows based front-end ... maybe I should try to offer some support to WinMyth?.)

Note: See TracTickets for help on using tickets.