mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.83k stars 2.87k forks source link

Request for TTML subtitle support (STPP) #7573

Closed teb closed 4 years ago

teb commented 4 years ago

I just tested a mp4 file with STPP (TTML) subs and mpv shows it as 0 subs. Output from mp4box under:

Track # 4 Info - TrackID 4 - TimeScale 1000
Media Duration 02:09:02.400 - Indicated Duration 02:09:02.400
Media Info: Language "Norwegian (nor)" - Type "subt:stpp" - 1825 samples
XML Subtitle Stream - namespace http://www.w3.org/ns/ttml
 Size 0 x 0 - Translation X=0 Y=0 - Layer 0
        RFC6381 Codec Parameters: stpp
        All samples are sync
jeeb commented 4 years ago

This should be a request towards FFmpeg.

Demuxing these is simple (as long as you remember stpp is "times are offsets from PTS=0, not the sample", and dfxp is "times the sane way, offsets from the sample"), too bad the format is XML and all. Thus I am noting that it is highly unlikely that someone will attempt to make a decoder for this.

CounterPillow commented 4 years ago

Already reported upstream https://trac.ffmpeg.org/ticket/4859

teb commented 4 years ago

Well, ffmpeg closed this case years ago, not willing to move it with a cryptic response ;). TTML is the defacto standard for CMAF in the form of the IMSC1 format which is common for Apple as well as android cmaf. @jeeb Not sure why the resentment for xml ?

CounterPillow commented 4 years ago

Well, ffmpeg closed this case years ago

No they didn't, the ticket is still open.

not willing to move it

because presumably, nobody who isn't getting paid to wants to touch this trash fire of a standard.

ghost commented 4 years ago

Not sure why the resentment for xml ?

Because it's one of the worst pieces of shits ever invented?

teb commented 4 years ago

@CounterPillow Ure right! Its still open for business, just got put of on the discussion at the end! @wm4 that can be

ghost commented 4 years ago

It certainly is. Because XML is so surprisingly complex and messy, and because there's no sane light-weight XML parser, ffmpeg does not well with XML based stuff. On top of this, TTML seems to have its own misdesigned mess on top of it.

3052 commented 6 months ago

looking at sample from Mubi, it seems easy enough to parse:

<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml"
xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="en"
ttp:profile="http://www.w3.org/ns/ttml/profile/imsc1/text">
  <head>
    <metadata>
      <ttm:title/>
      <ttm:desc/>
      <ttm:copyright/>
    </metadata>
    <styling>
      <style xml:id="basic" tts:backgroundColor="transparent" tts:color="white" tts:fontFamily="proportionalSansSerif" tts:fontSize="16px" tts:textAlign="center"/>
    </styling>
    <layout>
      <region style="basic" xml:id="speaker" tts:displayAlign="center" tts:extent="80% 10%" tts:origin="10% 85%"/>
    </layout>
  </head>
  <body>
    <div xml:lang="en">
      <p begin="00:01:08.000" end="00:01:09.642" region="speaker">Sorry to interrupt your dinner.</p>
      <p begin="00:01:09.666" end="00:01:10.000" region="speaker">Never mind, let's sit over there.</p>
    </div>
  </body>
</tt>