<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/atom.xsl" type="text/xsl"?><feed
	xmlns="http://www.w3.org/2005/Atom"
	xmlns:thr="http://purl.org/syndication/thread/1.0"
	xml:lang="en-US"
	><title>Sacha Chua - tag - subed</title>
	<subtitle>Emacs, sketches, and life</subtitle>
	<link rel="self" type="application/atom+xml" href="https://sachachua.com/blog/tag/subed/feed/atom/index.xml" />
  <link rel="alternate" type="text/html" href="https://sachachua.com/blog/tag/subed" />
  <id>https://sachachua.com/blog/tag/subed/feed/atom/index.xml</id>
  <generator uri="https://11ty.dev">11ty</generator>
	<updated>2021-01-10T05:59:00Z</updated>
<entry>
		<title type="html">Using Emacs to fix automatically generated subtitle timestamps</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2021/01/using-emacs-to-fix-automatically-generated-subtitle-timestamps/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2021-03-19T00:44:10Z</updated>
    <published>2021-01-10T05:59:00Z</published>
    <category term="emacs" />
<category term="subed" />
		<id>https://sachachua.com/blog/?p=29659</id>
		<content type="html"><![CDATA[<p>I like how people are making more and more Emacs-related videos. I think subtitles, transcripts, and show notes would go a long way to helping people quickly search, skim, and squeeze these videos into their day.</p>
<p>Youtube's automatically-generated subtitles overlap. I think some players scroll the subtitles, but the ones I use just display them in alternating positions. I like to have non-overlapping subtitles, so here's some code that works with <a href="https://github.com/rndusr/subed">subed.el</a> to fix the timestamps.</p>
<div class="org-src-container">
<pre id="nil" class="src src-emacs-lisp">(<span class="org-keyword">defun</span> <span class="org-function-name">my/subed-fix-timestamps</span> ()
  <span class="org-doc">"Change all ending timestamps to the start of the next subtitle."</span>
  (goto-char (point-max))
  (<span class="org-keyword">let</span> ((timestamp (subed-subtitle-msecs-start)))
    (<span class="org-keyword">while</span> (subed-backward-subtitle-time-start)
      (subed-set-subtitle-time-stop timestamp)
      (<span class="org-keyword">setq</span> timestamp (subed-subtitle-msecs-start)))))
</pre>
</div>
<p>Then it's easy to <a href="https://sachachua.com/blog/2020/12/editing-subtitles-in-emacs-with-subed-with-synchronized-video-playback-through-mpv/">edit the subtitles</a> (punctuation, capitalization, special terms), especially with the shortcuts for splitting and merging subtitles.</p>
<p>For transcripts with starting and ending timestamps per paragraph, I like using the merge shortcut to merge all the subtitles for a paragraph together. Here's a sample: <a href="https://emacsconf.org/2020/talks/05/">https://emacsconf.org/2020/talks/05/</a></p>
<p>Tonight I edited automatically-generated subtitles for a screencast that was about 40 minutes long. The resulting file had 1157 captions, so about 2 seconds each. I finished it in about 80 minutes, pretty much the 2x speed that I've been seeing. I can probably get a little faster if I figure out good workflows for:</p>
<ul class="org-ul">
<li>jumping: avy muscle memory, maybe?</li>
<li>splitting things into sentences and phrases</li>
<li>fixing common speech recognition errors (ex: emax -&gt; Emacs, which I handle with regex replaces; maybe a list of them?)</li>
</ul>
<p>I experimented with making a hydra for this before, but thinking about the keys to use slowed me down a bit and it didn't flow very well. Might be worth tinkering with.</p>
<p>Transcribing from scratch takes me about 4-5x playtime. I haven't tweaked my workflow for that one yet because I've only transcribed one talk with subed.el , and there's a backlog of talks that already have automatically generated subtitles to edit. Low-hanging fruit! =)</p>
<p>So that's another thing I (or other people) can occasionally do to help out even if I don't have enough focused time to think about a programming challenge or do a podcast myself. And I get to learn more in the process, too. Fun!</p>
]]></content>
		</entry><entry>
		<title type="html">Editing subtitles in Emacs with subed, with synchronized video playback through mpv</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2020/12/editing-subtitles-in-emacs-with-subed-with-synchronized-video-playback-through-mpv/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2021-03-19T00:44:08Z</updated>
    <published>2020-12-13T06:49:00Z</published>
    <category term="emacs" />
<category term="subed" />
<category term="emacsconf" />
		<id>https://sachachua.com/blog/?p=29650</id>
		<content type="html"><![CDATA[<p>I've been adding subtitles to the talks from <a href="https://emacsconf.org/2020/">EmacsConf 2020</a>, taking advantage of the text that was helpfully autogenerated when I uploaded the videos to the <a href="https://www.youtube.com/c/emacsconf/about">EmacsConf channel on YouTube</a>. Today I spent some time figuring out how to <a href="https://github.com/rndusr/subed/pull/18">add WebVTT support to subed</a>, an Emacs major mode for editing subtitles. It turns out that it's pretty cool to be able to bring up the relevant segment in the video whenever the text wasn't clear. Here's a quick video of it in action. It shows how I can mostly focus on adding punctuation and changing capitalization, checking every so often with mpv via <a href="https://github.com/kljohann/mpv.el">mpv.el.</a>&nbsp;All in all, it took me 24 minutes to edit the subtitles for a 17-minute talk. Whee!</p>


<figure class="wp-block-video"><video controls="" src="https://sachachua.com/blog/wp-content/uploads/2020/12/2020-12-13-Demonstration-of-using-subed-in-Emacs-to-edit-subtitles-with-synchronized-video-playing.webm"></video><figcaption>Demonstration of subed-mode</figcaption></figure>



<p>I submitted a pull request to get the .vtt support into subed-mode in case anyone else finds it helpful. I've only tested the mpv synchronization so far, and I'm looking forward to exploring its other features.</p>



<p>You can see these particular subtitles on the talk page for <a href="https://emacsconf.org/2020/talks/07/">Beyond Vim and Emacs: A Scalable UI Paradigm</a>. Enjoy!</p>



<p>Update 2020-12-13: subed-vtt.el has been merged into master, so you'll get it when you check out subed. Yay!</p>
<p>Update 2021-07-19: Check out Lindsey Kuper's <a href="http://web.archive.org/web/20220428003450/http://composition.al/blog/2021/07/14/how-to-create-an-srt-caption-file-for-a-video/">step-by-step instructions for getting YouTube to autogenerate captions that you can edit.</a></p>
]]></content>
		</entry>
</feed>