Kodi Community Forum

Full Version: Teletext Subtitles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
I wish to point attention to telxcc for extracting teletext subtitles into .srt files.
https://github.com/forers/telxcc#readme
It can be used for recordings (maybe modified for live transmissions).
It's fast, multiplatform and doesn't depend on any libraries. Written in C.
For recordings it would work but not for live tv and it should not be needed and that would mean a lot of work for me that have thousands of recordings.
We need real teletext subtitles support in XBMC both for recordings and streams.
I could setup vtuner + tvheadend again but that should not be needed and it's not optimal solution for me that want to watch outside my apartment.
And that only works for livetv and not for recordings.
My thought was that, ideally the great developers of XBMC could perhaps incorporate telxcc into XBMC so that no manual steps were needed to get subtitles when playing back recordings.
That still would not work for livetv so better use ffmpeg that already support teletext streams.
tvheadend pvr client already uses ffmpeg for that so i don't see why XBMC itself not could use ffmpeg to get that information.
If you take a look on the HTS pvr addon you understand what i mean.

Here is a part from HTSPDemux.cpp file

else if(!strcmp(type, "TELETEXT"))
{
newStreams.stream[newStreams.iStreamCount].iCodecType = AVMEDIA_TYPE_SUBTITLE;
newStreams.stream[newStreams.iStreamCount].iCodecId = CODEC_ID_DVB_TELETEXT;
}

If you look in avcodec.h for ffmpeg you can find it support these types

/* subtitle codecs */
CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
CODEC_ID_DVD_SUBTITLE = 0x17000,
CODEC_ID_DVB_SUBTITLE,
CODEC_ID_TEXT, ///< raw UTF-8 text
CODEC_ID_XSUB,
CODEC_ID_SSA,
CODEC_ID_MOV_TEXT,
CODEC_ID_HDMV_PGS_SUBTITLE,
CODEC_ID_DVB_TELETEXT,
CODEC_ID_SRT,
CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'),

As you can see the big problem is not adding support for Teletext it's already there so it's demuxing and reading the information from file that is the problem. Proper support for that should benefit other PVR parts too and not only Teletext.

It also would still be a problem with telxcc because XBMC still need to know which page, language etc and for that it needs proper demuxing of files and that's the problem as i understand it today. And when that works then it just needs a few lines for the teletext part after that.
If XBMC already had proper demuxing for TS files i could have done this myself because that's easy to modify but writing demuxing part etc is something i can't do.
But that telxcc util is useful when converting files etc ofcourse so can be useful for me in some cases.
AFAIK tvheadend parses teletext subs and put them into dvd subtitles. This is why they show up in the menu. So ideally you have to put this functionality into ffmpeg which does the demuxing.
nope, tvh just passes the DVBSUB stream from the service iic
(2013-02-20, 03:41)Leatherface Wrote: [ -> ]If you look in avcodec.h for ffmpeg you can find it support these types

/* subtitle codecs */
CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
CODEC_ID_DVD_SUBTITLE = 0x17000,
CODEC_ID_DVB_SUBTITLE,

8< 8< 8<

As you can see the big problem is not adding support for Teletext it's already there so it's demuxing and reading the information from file that is the problem. Proper support for that should benefit other PVR parts too and not only Teletext.

I took a little look at this and I am not sure it is that simple. If I understood the code correctly, you can actually force XBMC/ffmpeg to parse the ttx stream as subtitles by switching off teletext in settings. See DVDDemuxFFmpeg.cpp round about line 1042 for details. Starting BBC Entertainment (that have ttx subtitles for Danish, Swedish, Norwegian and Finnish) in debug mode I find the following in the log:

Code:
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]: Input #0, mpegts, from 'pvr://channels/tv/All TV channels/535.pvr':
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]:   Duration: 00:00:05.30, start: 47170.169189, bitrate: 4308 kb/s
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]:   Program 1
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]:     Stream #0:0[0x200]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]:     Stream #0:1[0x280](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 256 kb/s
10:21:22 T:2629462896    INFO: ffmpeg[9CBA6B70]:     Stream #0:2[0x240](dan): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)

So far so good. However further down you get:

Code:
10:21:22 T:2629462896  NOTICE: Opening Subtitle stream: 2 source: 256
10:21:22 T:2629462896   DEBUG: FactoryCodec - Overlay: FFmpeg Subtitle Decoder - Opening
10:21:22 T:2629462896   DEBUG: Open - Unable to find codec 94215
10:21:22 T:2629462896   DEBUG: FactoryCodec - Overlay: FFmpeg Subtitle Decoder - Failed
10:21:22 T:2629462896   ERROR: OpenStream - Unable to init overlay codec
10:21:22 T:2629462896 WARNING: OpenSubtitleStream - Unsupported stream 2. Stream disabled.

So it seems that ffmpeg does not really know how to decode this. Running a fairly new version of ffprobe on a recording from the same channel yields:

Code:
$ /usr/local/src/ffmpeg/ffprobe 2103_20130218210000.mpg
ffprobe version N-49615-gb0635e2 Copyright (c) 2007-2013 the FFmpeg developers
  built on Feb 20 2013 17:34:55 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-nonfree
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
[mpegts @ 0x3097420] max_analyze_duration 5000000 reached at 5016000 microseconds
[mpegts @ 0x3097420] PES packet size mismatch
Input #0, mpegts, from '2103_20130218210000.mpg':
  Duration: 00:34:56.10, start: 20792.287967, bitrate: 4268 kb/s
  Program 1
    Stream #0:0[0x200]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x280](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:2[0x240](dan): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Unsupported codec with id 94215 for input stream 2

So, same problem there. Maybe not so strange, because when you look for teletext codecs in ffmpeg I think it is defined but not implemented.

Code:
:~/src/ffmpeg/libavcodec$ grep -I -i "teletext" *
avcodec.h:    AV_CODEC_ID_DVB_TELETEXT,
codec_desc.c:        .id        = AV_CODEC_ID_DVB_TELETEXT,
codec_desc.c:        .name      = "dvb_teletext",
codec_desc.c:        .long_name = NULL_IF_CONFIG_SMALL("DVB teletext"),
old_codec_ids.h:    CODEC_ID_DVB_TELETEXT,


(2013-02-20, 03:41)Leatherface Wrote: [ -> ]It also would still be a problem with telxcc because XBMC still need to know which page, language etc and for that it needs proper demuxing of files and that's the problem as i understand it today. And when that works then it just needs a few lines for the teletext part after that.
If XBMC already had proper demuxing for TS files i could have done this myself because that's easy to modify but writing demuxing part etc is something i can't do.

I am certainly no expert on the XBMC code but I think that the current teletext parser in DVDPlayerTeletext.cpp could be extended to parse out subtitles and add/feed those to the player. Ideally it should parse out the subtitle types (2 or 5 for subtitles vs for hearing impaired) and language and match that to the subtitle language preference from settings.

Thoughts from the experts?

/D
I don't know i just know i had Teletext subtitles working with HTS PVR addon earlier and it parses Teletext stream from libavcodec if you take a look on the code. I guess it's because HTS reads it in another way that makes it possible.
I just found out that i can use teletext subtitles with xbmc live-tv from enigma 2 pvr addon.

I had to press "V" on my keyboard and then enter the right subtitle page nr: 199 for canal digital and 690 for viasat.
Hope you guys can fix so it can be changed via meny and saved / channel.

In mean time, is there a way to get my mce remote to send "V" when i press the teletext button ?
Yes that works but text is not in sync so it's useless.
The text comes a few seconds wrong.
So either teletext plugin needs to be synced with audio/video or XBMC need to read teletext subtitles from ffmpeg as HTS PVR addon for example does. I prefer the later solution and that would fix playing TS recoring files also and not only live tv.
And it should be easier to fix instead of trying to sync the old tuxtxt plugin code.
Many people records from TV with Teletext but german people and other countries without subtitles seems to not understand how important this is.
I have downloaded many "latest" versions of XBMC past years. Swedish subs is still synced wrong (from teletext). Can't use some channels. Please fix.
Please provide patches.
A media center should have support for as many filetypes as possible and many people have ts recordings with teletext subtitles.
With tvheadend i get swedish subtitles on channels but that's not enough because it only works for live tv and not recordings.
It's in the mediacenter itself it needs support for teletext and not only PVR part.
Stop igoring this and understand it's important for all non dubbing cuontries.
ahaa...that's why I can't get the swedish subtitles in xbmc live TV.
Too bad, but I think I will hang on to the DVBviewer Pro client until/if it's fixed.

But XBMC is still my no1 home cinema client Smile
Will this recent patch to ffmpeg be a step forward?
http://git.videolan.org/?p=ffmpeg.git;a=...7f9ba064e6
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14