I'm having trouble locating any Emacs modes supporting YouTube caption/subtitles files.

This YouTube help page details the list of file formats for subtitles and captioning supported by YouTube:

  • Basic file formats
    • SubRip (.srt)
    • SubViewer (.sbv or .sub)
    • MPsub (.mpsub)
    • LRC (.lrc)
    • Videotron Lambda (.cap)
  • Advanced file formats
    • SAMI (.smi or .sami)
    • RealText (.rt)
    • WebVTT (.vtt)
    • TTML (.ttml)
    • DFXP (.ttml or .dfxp)
  • Broadcast file formats
    • Scenarist (.scc)
    • EBU-STL (.stl)
    • Caption Center (.tds)
    • Captions Inc. (.cin)
    • Cheetah (.asc)
    • NCI (.cap)

The help page ends with the note:

Scenarist Closed Caption (.scc file extension) files are our preferred file format. These files have an exact representation of CEA-608 data, which is the preferred format whenever captions are based on CEA-608 features.

Short of trying each of these formats and seeing if any of them are close enough to a mode Emacs does deal with, I'm not sure which of these, if any, are editable with Emacs as more than plain text or XML. (Most of the "broadcast" ones listed above aren't even that, they're binary files.)

TTML, being an XML language (see, for example, this gist), obviously can be edited and syntax-highlighted. But what dedicated captions editors do goes far beyond this; at a minimum, you need a programmatic way of dealing with timestamps.

Anyone have any suggestions for solutions here for Emacs?


Just in case someone else is wondering about this, I downloaded the autogenerated SBV files, converted them to WebVTT and fixed the timestamps to be non-overlapping, and then used the subed package (https://github.com/rndusr/subed) to edit the timestamps. I have a blog post at https://sachachua.com/blog/2020/12/editing-subtitles-in-emacs-with-subed-with-synchronized-video-playback-through-mpv/ with some details. I like the workflow because I can play the video from a local file or URL via mpv, and subed can pick up or manipulate the current playback position.

  • Sacha, thanks—my workstation had a hardware failure so I can’t test this yet (unless there’s some clever way to use TTY-mode Emacs and control the video playing on a different device?), so I apologize if it takes a couple weeks before I can accept it. It sounds great, though, thanks again!
    – Trey
    Feb 17 '21 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.