Project

General

Profile

Playing DVB-T subtitles (S_DVBSUB)

Added by Mikael Jepsen over 13 years ago

Hi all,

I'm using Dushmaniacs xbmc-pvr/tvheadend builds, but cannot get subtitles to show.
I've tried vlc, xbmc and mplayer with no luck.
Playing a live stream (h264) in vlc through tvheadend via http works fine - I can switch subs on and off as needed.

Does anyone have success playing tvh-recorded video with S_DVBSUB subtitles?

During my investigation I've come across http://lists.matroska.org/pipermail/matroska-devel/2011-February/003985.html in which Andreas mentions that he intend to change the implementation, but I could not find any traces of such a change in the repo.

Can anybody shed some light on this?

Thanks,
Mikael

Version: HTS Tvheadend 2.12.99~git20110313.1aa214~odk1
mkvmerge -i:
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: audio (A_AAC)
Track ID 4: subtitles (S_DVBSUB)
Track ID 5: subtitles (S_DVBSUB)


Replies (15)

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Andreas Smas over 13 years ago

Does even VLC, XBMC or Mplayer support DVBSUB in their code?

I don't think so.

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Mikael Jepsen over 13 years ago

Possibly not - I haven't checked myself to be honest.

<edit 2011-05-12 @ 12:57>
A little research reveals that there is in fact a dvbsub module in vlc (which I guess is being used when playing a live http stream via tvheadend),
but the following post suggests that there is currently no support for a dvbsub stream in mkv: http://forum.videolan.org/viewtopic.php?f=7&t=87479.
I do not know enough about dvbsub to tell if/how this affects playing a S_DVBSUB stream from tvheadend
</edit>

I thought maybe mplayer/FFmpeg as I saw you mentioning a one-line patch to FFmpeg...
What other options do we have then for playing the subs? Showtime?
There is not much use in having them in the mkv if we cannot show them ;-)

Thanks,
Mikael

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Matti Virtala over 13 years ago

I've been struggling with same problem, i.e. lack of S_DVBSUB support on players. In past I have used VDR, then cutting recording with ProjectX and remuxing resulting M2V, MP2 and VobSub format subtitles to MKV which has worked well. ProjectX can read DVB subtitles and export them as VobSub.

Any suggestions how to convert S_DVBSUB subtitles to format ProjectX could open? I could then convert them to VobSub and remux mkv with VobSub bitmap subtitles. I have extracted subtitles using "mkvextract tracks recording.mkv --raw 3:recording.rawsub" command. File that mkvextract dumps looks very similar to DVB subpicture files ProjectX can process ("ES Subpicture 2-bit RLE"). Obvious difference is that file extracted using mkvextract is missing header.

I don't have same recording from TVheadend and VDR to compare, but these are from same channel.

TVheadend S_DVBSUB extracted using mkvmerge:

00000000  0f 10 00 01 00 08 03 d8  00 00 00 a0 01 d4 0f 11  |.......+... .+..|
00000010  00 01 00 10 00 58 01 90  00 2a 48 01 00 00 00 00  |.....X...*H.....|
00000020  00 00 00 00 0f 12 00 01  00 62 01 50 00 41 00 00  |.........b.P.A..|
00000030  00 00 01 41 1d 80 80 91  02 41 1d 80 80 00 03 41  |...A.....A.....A|
00000040  10 80 80 00 04 41 10 80  80 00 05 41 10 80 80 00  |.....A.....A....|

VDR recorded subpicture stream extracted using ProjectX:

00000000  53 50 fa 27 78 2c 00 00  00 00 11 2d 00 00 0f 10  |SPú'x,.....-....|
00000010  00 01 00 08 04 78 00 00  00 3b 01 d2 0f 11 00 01  |.....x...;.+....|
00000020  00 10 00 08 01 90 00 2c  48 01 00 00 00 00 00 00  |.......,H.......|
00000030  00 00 0f 12 00 01 00 62  01 20 00 41 00 00 00 00  |.......b. .A....|
00000040  01 41 1d 80 80 91 02 41  1d 80 80 00 03 41 10 80  |.A.....A.....A..|

Different language subs from same VDR recording:

00000000  53 50 80 ba 77 2c 00 00  00 00 29 cf 00 00 0f 10  |SP.|w,....)+....|
00000010  00 02 00 0e 07 88 00 00  00 3b 01 9a 01 00 00 3b  |.........;.....;|
00000020  01 d2 0f 11 00 02 00 10  00 c8 02 08 00 32 48 01  |.+.......+...2H.|
00000030  00 00 00 01 00 00 00 00  0f 11 00 02 00 10 01 d8  |...............+|
00000040  02 0e 00 2c 48 01 00 00  00 00 00 00 00 00 0f 12  |...,H...........|
00000050  00 02 00 62 01 70 00 41  00 00 00 00 01 41 1d 80  |...b.p.A.....A..|
00000060  80 91 02 41 1d 80 80 00  03 41 10 80 80 00 04 41  |...A.....A.....A|

I've tried appending bits from beginning of working file to beginning of demuxed S_DVBSUB, but resulting file is treated as unknown by ProjectX. Didn't really expect it to work either as there's obviously more than just signature ("SP") on those first few bytes.

-MV

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Juha Ruotsalainen over 13 years ago

Same problem here.

Andreas, could you shed some light on the subtitle format in a DVR Matroska file?

I'm planning on writing an app that would convert S_DVBSUB into S_IMAGE/BMP or S_VOBSUB. I would imagine those format would enable subtitles being shown in VLC/XBMC/whatnot. Then again, I may be imagining things...

--
jussi

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Juha Ruotsalainen over 13 years ago

Good call, Mikko!

This got me into looking at VLC's codebase: its Matroska demuxer code has a similar place where it checks for various streams and sets an interval VLC codec id based on that. Now, if I only had the time to try out tweaking VLC's code to add S_DVBSUB there...

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Andreas Smas over 13 years ago

Juha Ruotsalainen wrote:

Same problem here.

Andreas, could you shed some light on the subtitle format in a DVR Matroska file?

I'm planning on writing an app that would convert S_DVBSUB into S_IMAGE/BMP or S_VOBSUB. I would imagine those format would enable subtitles being shown in VLC/XBMC/whatnot. Then again, I may be imagining things...

Yes, perhaps it would be even better to have Tvheadend do convertion to VOBSUB itself internally.

Or we could convince the developers of ffmpeg, vlc, etc to add support for DVBSUB in the code.
On all ffmpeg derivates (mplayer, xbmc, etc) it's just a one line patch as seen in this thread

--
jussi

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Dennis Kurten about 13 years ago

I recently started using ppa-pvr and tvheadend and ran into this same problem.

Subtitles (DVBSUB) work when watching live tv (which I suspect is on account of
the special HTSP code in "xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp")
but not from recorded matroska files.

Is it possible to manually convert the matroska back to a .ts and then extract the
subtitles with something like ProjectX? Nothing I've tried can make any sense of
the raw data extracted with mkvextract.

Also, I'd like to have a look at the patch Mikko supplied, but the link is down.

- Dennis

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Mikael Jepsen about 13 years ago

For reference, this is the one line patch Mikko supplied:

diff --git a/lib/ffmpeg/libavformat/matroska.c b/lib/ffmpeg/libavformat/matroska
index c7e9663..dd22ccd 100644
--- a/lib/ffmpeg/libavformat/matroska.c
+++ b/lib/ffmpeg/libavformat/matroska.c
@@ -59,6 +59,7 @@ const CodecTags ff_mkv_codec_tags[]={
     {"S_ASS"            , CODEC_ID_SSA},
     {"S_SSA"            , CODEC_ID_SSA},
     {"S_VOBSUB"         , CODEC_ID_DVD_SUBTITLE},
+    {"S_DVBSUB"         , CODEC_ID_DVB_SUBTITLE},
     {"S_HDMV/PGS"       , CODEC_ID_HDMV_PGS_SUBTITLE},

     {"V_DIRAC"          , CODEC_ID_DIRAC},


I considered requesting Dushmaniac to include the patch in xbmc-pvr, but if Andreas could make tvheadend convert it to VOBSUB, I guess that would be better (i.e. less need to convince a lot of other projects to the tvheadend way of putting subs in mkv). I'm not sure from Andreas' response if this is easy to do and/or could be done soon... If not, I guess a xbmc-pvr fix would be nice for the time being.

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Dennis Kurten about 13 years ago

Works like a charm, thank You!

Since it was this easy, I suppose that if ffmpeg only were to patch their code it would
propagate in a clean way to all projects that rely on that library.

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Juha Ruotsalainen about 13 years ago

Hi guys!

Just to make sure: are you using Lars Op dem Kamp's PPA as the source for the XBMC source code, or have you cloned the source code from github?

A side note: I reverted back to using VDR, since my time is limited, and in VDR subtitles work. But before that I recorded a whole bunch of Italian language course programs with tvheadend. I can say, that it's pretty tough trying to watch those without a hint of a subtitle :)

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Mikael Jepsen about 13 years ago

Dennis Kurten: Yes indeed, however VLC for one does not use ffmpegs libavformat (they use their own demuxer), so they would not be fixed with this.

@Juha: Yes, I'm using Lars Op dem Kamp (aka. Dushmaniac)'s xbmc-pvr repo, but I guess either would be fine just for playing the files.

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Dennis Kurten about 13 years ago

Hello Juha,

I'm using the pvr-ppa branch from Lars' repo on github.

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Hein Rigolo about 13 years ago

tvheadend is one of the first programs to generate S_DVBSUB streams in a mkv, so that is why there is no widespread support for it yet.

Conversion of DVB subtitles to an other format is hard to do because DVB subtitles are not text but bitmaps. So any conversion would require OCR to convert the bitmaps back to text (ASCII). There are programs out there that can do this, but doing it "real-time" while writing the mkv could be difficult. An other drawback is that you loose information. One of the reasons that mkv was chosen as the file format for tvheadend was to contain as much as possible all the details of the program that was recorded, while also being able to add additional meta-data to the file. mkv is the only container format that allows for that at the moment.

Initially it was not possible to store the DVB subtitles into a mkv container. After some discussions with mkv developers on IRC it was decided that the S_DVBSUB stream would be added to the mkv as a separate track. At that time the tvheadend mkv muxer was the only program around that could do this.

Andreas was involved in a discussion with the MKV developers to get a S_DVBSUB correctly implemented in an mkv container (see this mailing list archive: http://lists.matroska.org/pipermail/matroska-devel/2011-February/thread.html#3948 ). Once this has been done, then others programs can use this format also. The VLC developers have also said that they would like to support the S_DVBSUB format.

I know of one other program that can use S_DVBSUB and that is a commercial program called VideoReDo.

Hein

RE: Playing DVB-T subtitles (S_DVBSUB) - Added by Jaime Vazquez over 12 years ago

Can someone help me understand how to apply the above patch to my xbmcbuntu installation? I've never done that before but would like to lean how. Thanks!

    (1-15/15)