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