1*a2dfb722SXin LI 2*a2dfb722SXin LI#------------------------------------------------------------------------------ 3*a2dfb722SXin LI# $File: subtitle,v 1.2 2022/09/07 11:29:09 christos Exp $ 4*a2dfb722SXin LI# subtitle: file(1) magic for subtitles files 5*a2dfb722SXin LI 6*a2dfb722SXin LI# EBU-STL 7*a2dfb722SXin LI# https://tech.ebu.ch/docs/tech/tech3264.pdf 8*a2dfb722SXin LI3 string STL EBU-STL subtitles 9*a2dfb722SXin LI>6 regex =^[0-9][0-9] \b, rate %s 10*a2dfb722SXin LI>>8 string .01 \b, v1 11*a2dfb722SXin LI!:mime application/x-ebu-stl 12*a2dfb722SXin LI>>>16 regex =^[^\ ]{0,32} \b, title "%s" 13*a2dfb722SXin LI>>>>224 regex =^[0-9]{2} \b, created %-.2s 14*a2dfb722SXin LI>>>>>&0 regex =^[0-9]{2} \b-%-.2s 15*a2dfb722SXin LI>>>>>>&0 regex =^[0-9]{2} \b-%-.2s 16*a2dfb722SXin LI!:ext stl 17*a2dfb722SXin LI 18*a2dfb722SXin LI# SubRip (srt) subtitles 19*a2dfb722SXin LI0 regex/20 =^1[\r\n]+0[01]:[0-9]{2}:[0-9]{2},[0-9]{3}\040--> SubRip 20*a2dfb722SXin LI!:mime application/x-subrip 21*a2dfb722SXin LI!:ext srt 22*a2dfb722SXin LI 23*a2dfb722SXin LI# WebVTT subtitles 24*a2dfb722SXin LI# https://www.w3.org/TR/webvtt1/ 25*a2dfb722SXin LI0 string/t WEBVTT 26*a2dfb722SXin LI>&0 regex/255 =[0-9]{2}:[0-9]{2}\\.[0-9]{3}\040--> WebVTT subtitles 27*a2dfb722SXin LI!:mime text/vtt 28*a2dfb722SXin LI!:ext vtt 29*a2dfb722SXin LI 30*a2dfb722SXin LI# XML TTML subtitles 31*a2dfb722SXin LI# https://www.w3.org/TR/ttml2/ 32*a2dfb722SXin LI0 string/t \<?xml 33*a2dfb722SXin LI>20 search/400 \020xmlns= 34*a2dfb722SXin LI>>&0 regex ['"]http://www.w3.org/ns/ttml TTML subtitles 35*a2dfb722SXin LI!:mime application/ttml+xml 36*a2dfb722SXin LI# Augment strength to beat plain XML 37*a2dfb722SXin LI!:strength * 3 38*a2dfb722SXin LI!:ext ttml 39