subtitle 1.0 KB

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