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