(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