pkoshevoy / aeyae

apprenticevideo (video player), aeyae remux (video remuxer), yaetv (digital video recorder), yamka (matroska format toolkit), yathe (legacy code for 3D geometry transforms, bezier curves, spline curves, and UI abstraction layers)
22 stars 6 forks source link

Subtitle: TTML support #6

Open 3052 opened 5 months ago

3052 commented 5 months ago

I have the below file, the subtitles will not load

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.16.100
  Duration: 01:38:48.75, start: 0.000000, bitrate: 3957 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1200x720 [SAR 1:1 DAR 5:3], 3822 kb/s, 24 fps, 24 tbr, 19200 tbn (default)
    Metadata:
      handler_name    : USP Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](zho): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : USP Sound Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Subtitle: ttml (stpp / 0x70707473), 1 kb/s (default)
    Metadata:
      handler_name    : USP Subtitle Handler
pkoshevoy commented 5 months ago

@3052 Is there a publicly available sample file with this subtitle type? Does this subtitle type work with any known player (vlc or ffplay)?

3052 commented 5 months ago

https://github.com/pkoshevoy/aeyae/files/14601290/af343964d7-textstream_eng.1000.zip

it works with VLC

pkoshevoy commented 5 months ago

@3052 ffmpeg doesn't have a decoder for ttml, and as my player depends on ffmpeg API for demuxing/decoding -- ttml subtitles most likely are not going to be supported until they are supported by ffmpeg.

ffplay version N-114162-g2129d66a66 Copyright (c) 2003-2024 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/Users/pavel/x86_64 --disable-debug --enable-libx264 --enable-libzimg --enable-libass --enable-libbluray --enable-libmodplug --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-runtime-cpudetect --extra-cflags=-I/opt/local/include --extra-ldflags='-headerpad_max_install_names -L/opt/local/lib'
  libavutil      59.  1.100 / 59.  1.100
  libavcodec     61.  1.101 / 61.  1.101
  libavformat    61.  0.100 / 61.  0.100
  libavdevice    61.  0.100 / 61.  0.100
  libavfilter    10.  0.100 / 10.  0.100
  libswscale      8.  0.100 /  8.  0.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    58.  0.100 / 58.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.0.100
  Duration: 03:53:20.06, start: 0.000000, bitrate: 1331 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x480 [SAR 8:9 DAR 4:3], 1165 kb/s, 23.98 fps, 23.98 tbr, 16k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Subtitle: ttml (stpp / 0x70707473), 1 kb/s (default)
      Metadata:
        handler_name    : USP Subtitle Handler
No decoder could be found for codec ttml
   7.61 A-V: -0.002 fd=   1 aq=   34KB vq=   13KB sq=    0B 
3052 commented 5 months ago

yeah, seems like support for TTML is pretty crappy at this time, missing from FFmpeg and MPV. as a workaround, it seems WebVTT is pretty common with better support: