1

Target is view html subtitles in vtt format in TV when AirPlay is running.

html code:

<video preload="metadata" x-webkit-airplay="allow" src="a.mp4">
    <track kind="subtitles" default="" src="en.vtt" srclang="en">
    <track kind="subtitles" src="de.vtt" srclang="de">
    <track kind="subtitles" src="es.vtt" srclang="es">
    <track kind="subtitles" src="fr.vtt" srclang="fr">
</video>

The problem is when AirPlay is enabled video and audio plays on TV, but no subtitles showed.

I tried to include vtt/srt subtitles into the mp4 metadata with ffmpeg and subtitles working with VLC but not working when AirPlay this files

ffmpeg -i 8499.mp4 -i 8499.en.vtt -map 0:v -map 0:a -c copy -map 1 -c:s:0 mov_text -metadata:s:s:0 language=en 8499.en.mp4
ffmpeg -i 8499.mp4 -i 8499.en.srt -map 0:v -map 0:a -c copy -map 1 -c:s:0 srt -metadata:s:s:0 language=en 8499.en.mp4

Also tried to send a .m3u8 with no luck. Any of you know how is the basic format for a simple .m3u8 with a .mp4 and .vtt working when AirPlay?

Which is the standard subtitles solution for AirPlay?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
skatehype
  • 73
  • 1
  • 11

1 Answers1

2

I'm not surprised that iOS doesn't Airplay the VTT subtitles from <video> to an Airplay sink.

iOS (and probably tvOS as well) only supports 1 embedded subtitle/captioning format: MP4 Timed Text / MPEG-4 Part 17. Sometimes it is called Quicktime Timed Text. Safari also supports VTT (but not SRT) for <video>, but that is only in Safari.

One of your ffmpeg examples is close. If you want to Airplay MP4 files with subtitles/captions you must start with an SRT subtitle file as the input. Not an MP4 Timed Text file (which are far less common than SRT). Using mov_text will encode it.

This is an example I found in another answer relating to this question.

ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4

Note: the order of -c commands matters if you use -c copy. You must specify any source stream changes after it

pseudosavant
  • 7,056
  • 2
  • 36
  • 41
  • From https://ffmpeg.org/general.html#toc-Subtitle-Formats "3GPP Timed Text" ffmpeg not support muxing, demuxing for this format. – skatehype Feb 23 '22 at 07:11
  • I didn't realize that. I've only muxed MP4TT once and it was a long time ago. I might have used mp4box. It appears that the best way to do it is to use an `srt` file as the subtitle input and use the `mov_text` command. I'm updating my answer, and adding a link to another answer. – pseudosavant Feb 26 '22 at 01:49