summaryrefslogtreecommitdiffstats
path: root/magic/Magdir/subtitle
blob: cfbe293d59eda5c4fae5ac4dccbb5f879b9ddf0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#------------------------------------------------------------------------------
# $File: subtitle,v 1.2 2022/09/07 11:29:09 christos Exp $
# subtitle:  file(1) magic for subtitles files

# EBU-STL
# https://tech.ebu.ch/docs/tech/tech3264.pdf
3	string	STL		EBU-STL subtitles
>6	regex	=^[0-9][0-9]	\b, rate %s
>>8	string	.01		\b, v1
!:mime	application/x-ebu-stl
>>>16	regex	=^[^\ ]{0,32}	\b, title "%s"
>>>>224 regex	=^[0-9]{2}	\b, created %-.2s
>>>>>&0 regex	=^[0-9]{2}	\b-%-.2s
>>>>>>&0 regex	=^[0-9]{2}	\b-%-.2s
!:ext	stl

# SubRip (srt) subtitles
0	regex/20	=^1[\r\n]+0[01]:[0-9]{2}:[0-9]{2},[0-9]{3}\040-->	 SubRip
!:mime	application/x-subrip
!:ext	srt

# WebVTT subtitles
# https://www.w3.org/TR/webvtt1/
0	string/t	WEBVTT
>&0	regex/255	=[0-9]{2}:[0-9]{2}\\.[0-9]{3}\040-->	WebVTT subtitles
!:mime	text/vtt
!:ext	vtt

# XML TTML subtitles
# https://www.w3.org/TR/ttml2/
0	string/t	\<?xml
>20	search/400	\020xmlns=
>>&0 regex ['"]http://www.w3.org/ns/ttml    TTML subtitles
!:mime	application/ttml+xml
# Augment strength to beat plain XML
!:strength * 3
!:ext	ttml