SRT subtitles in XML-format (HeadWeb plugin dev.) (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Hi

    A short introduction
    HeadWeb is an online movie rental site, available in Sweden, Norway, Denmark and Finland. Along with their movies, they offer subtitles for most of them. Normally they are available in all four languages.

    Issue at hand
    The subtitles are in some kind of XML-format, but the source seems to be SRT-based (judging from the source..)

    I'm currently looking into the options of doing a plugin for MediaPortal with the above features.

    Example below:
    http://img4.headweb.com/subtitles/131054_1004.xml

    1. Which subtitles formats can I expect MediaPortal to support?
    2. Would the internal player allow me to a) download the subtitle and strip the XML, leaving a well-formed SRT file in a directory and b) load this file into the player?

    The SRT format is really simple, so a little code-stripping with the mentioned files, should enable me to pass a usable format to the player:

    Take this format
    <p xml:id="sub1" begin="20.000s" end="24.400s">
    Filmen er inspireret af en særlig gruppe børn og af personlig fantasi.
    </p>

    <p xml:id="sub2" begin="24.600s" end="278.800s">
    At et menneskes potentiale realiseres fuldt ud, ser man ikke hver dag.
    </p>


    And convert it to this format
    1
    00:00:20,000 --> 00:00:24,400
    Filmen er inspireret af en særlig gruppe børn og af personlig fantasi.

    2
    00:00:24,600 --> 00:00:27,800
    At et menneskes potentiale realiseres fuldt ud, ser man ikke hver dag.

    But I need to save it locally and load it into the player...

    :confused:
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    1. Which subtitles formats can I expect MediaPortal to support?

    Same as MPC-HC. SRT should be supported. Iäm not sure if external subtitles are supported or should the subtitles be muxed inside the container.

    2. Would the internal player allow me to a) download the subtitle and strip the XML, leaving a well-formed SRT file in a directory and b) load this file into the player?

    Internal player cannot download at least the content. You probably will end up in writing a separate player and maybe some specific graph building code as well.

    btw. how about the DRM?
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #3
    1. Which subtitles formats can I expect MediaPortal to support?

    Same as MPC-HC. SRT should be supported. Iäm not sure if external subtitles are supported or should the subtitles be muxed inside the container.

    2. Would the internal player allow me to a) download the subtitle and strip the XML, leaving a well-formed SRT file in a directory and b) load this file into the player?

    Internal player cannot download at least the content. You probably will end up in writing a separate player and maybe some specific graph building code as well.

    btw. how about the DRM?

    So far I have successfully used a stripped-down version of the player from OnlineVideos, but there are many things to be worked out. The movies from HeadWeb comes in either RTMPE (secure Flash) or in MS Silverlight.

    OnlineVideos uses an RTMP library that is able to play the flash content, but it seems like Silverlight content is dead in the tracks :mad:

    Since the internal player can load a subtitle and add it on playback (downloaded with SubCentral) I thought it would be possible to do the same with online content, but I can see that there is a difference in playing local and remote content...

    While looking at how others have implemented HeadWeb, I found that Plex just embeds a Flash-player and a Silverlight-player in the plugin. While this looks really easy, the drawback is terrible performance - and I guess there is no Silverlight-player for Linux and Mac OS.

    The Boxee HeadWeb plugin just filters out Silverlight-content.

    If only we could get Netflix here in Europe, life would be a sweet deal ;)
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    While looking at how others have implemented HeadWeb, I found that Plex just embeds a Flash-player and a Silverlight-player in the plugin. While this looks really easy, the drawback is terrible performance

    Embedding flash / silverlight will give "horrible" playback quality. Judder is most likely there and we cannot do anything to fix it.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #5
    Where should I start looking in MediaPortal, to find the code that loads text-based subtitles into the player? I can find where teletext and dvb-subs are loaded...

    I already use a custom player based on the one from OnlineVideos, so I don't see a problem in modifying it. My goal would be to auto-download and save the subtitles somewhere, and then auto-load them into the player (when the stream starts), and let the user select stream (like if you played a video with subtitles outside the container).
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #6
    Hmm...since the file is played/downloaded differently depending on the codec you use, can you set a finite path for the subtitles? I.e. C:\Subs\ and make the sub-engine look in this folder?

    Playback of file is in the style of
    g_Player.Play(http://127.0.0.1:30006/0/127.0.0.1/...id=2821042&s=c7bee2fb3f590f4a296fdd555a1c524e Video)

    So:

    1. It's using OnlineVideos built-in proxy, needed for RTMP-content
    2. File name is impossible to use for sub-lookup

    Don't really know where to go from here :confused:
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #7
    Heh...got it working ;)

    Only challenge right now is, that in order to enable subtitles, the subtitle dir used must be configured in MediaPortal Configuration, for test-purposes I used C:\Subs\ which then should be added to the dirs MPC HC (or FFDShow) looks for subtitles in. I'll try and overcome this later on.

    So, the plugin downloads subtitles in XML-format in all languages (currently 4), re-arranges them to SRT-format, and saves them in C:\Subs\Moviename.Language.srt order.

    Then I just load the subtitles with a fake moviefile matching the subtitle Moviename. Here I remove characters not allowed in Windows-filenames.

    I'll release a test-version of the plugin when I've done the rest of the coding.
     

    Attachments

    • shot1.jpg
      shot1.jpg
      84.9 KB
    • shot2.jpg
      shot2.jpg
      58.5 KB

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #9
    Short background:

    I'm still working on this plugin, RTMPE playback is causing a headache the size of Nebraska :(
    My goal is to create a MediaPortal-plugin allowing HeadWeb users to rent and watch movies online from MediaPortal. Unfortunately the project is stopped by my RTMPE problems.

    offbyone:

    First; rtmpdump.exe works really fast and have always done so. It starts downloading the file within 1-2 seconds. I have updated RTMP_LIB to the latest version in OnlineVideos SVN.

    It is still random if the movie plays or not. I would say that it works ~ 30% of the time.

    I have attached two debug-logs from MediaPortal, one is ok, second is not. As you can see from the bad one (log_bad.txt) the error is failed to read RTMP packet header.

    I have adjusted the timeout in the the webrequest, but I doubt the problem lies here. After all, rtmpdump grabs the data almost instantly and does so in every test I make.

    The failed header also results in a System.Net.Sockets.SocketException. But I'm not sure if that is even relevant.

    Since a playback URL is only valid while the token is ( a user-session) an rtmpdump test like
    Code:
    rtmpdump -r "rtmpe://fl2.stream.headweb.com:443/headweb/274112?t=a44bbf01-c67f-4093-851d-17cfa61bc874&u=111471&a=p&said=4096277&" -o testerbare.flv -z -V
    will probably not work for you...

    Did you convert the RTMP_LIB from the C++ library from rtmpdump, or did you make it yourself? I know you have been working on the rtmp-part of OnlineVideos, but I still have hopes on getting HeadWeb working.
     

    Attachments

    • log_ok.txt
      36.4 KB
    • log_bad.txt
      8.5 KB

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    One thing I could spot:
    The log says port 443 which would mean SSL encrypted RTMP traffic - not supported by the C# lib yet :( -- but this would mean playback would never work...? (1935 is the usual port).
    Does the rtmpdump log say that it uses SSL?
     

    Users who are viewing this thread

    Top Bottom