summaryrefslogtreecommitdiffstats
path: root/2020/organizers-notebook.org
blob: 19ad9138c206b986cfc28faeca0e8e2160e1a5dc (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
#+todo: TODO(t) INPROGRESS(i) | DONE(d) CANCELLED(c)
#+PROPERTY: header-args    :results silent

* Tasks
** DONE bandali: Copy compressed files from front0:/var/www/media.emacsconf.org/2020 to CSC mirror and update links
CLOSED: [2020-12-09 Wed 22:26]
** Manually transcribe
Either subtitles (with timestamps) or a text transcript (no timestamps) is perfectly okay.
*** TODO mplsCorwin: emacsconf-2020--03-idea-to-novel-superstructure-emacs-for-writing--questions--bala-ramadurai.webm
*** TODO mplsCorwin: emacsconf-2020--08-building-reproducible-emacs--andrew-tropin.webm
*** DONE sachac: emacsconf-2020--10-lead-your-future-with-org--andrea.webm
    CLOSED: [2020-12-10 Thu 09:27]
    :LOGBOOK:
    - State "DONE"       from "TODO"       [2020-12-10 Thu 09:27]
    :END:
Added transcript to info/10.md, seeing if YouTube can automatically
assign timing. Took about 24 minutes to transcribe 8 minute talk. If
it doesn't work out, I might manually time it.

... It worked!

*** TODO zaeph: emacsconf-2020--24-analyze-code-quality-through-emacs-a-smart-forensics-approach-and-the-story-of-a-hack--andrea.webm
** Edit automatic subtitles
No need to worry about end timestamps, since I'll set them to the
beginning timestamp. To reduce duplication of work, make sure you have the latest copy of organizers-notebook.org. Mark the one you
want to do by prepending your name to the TODO title, and commit
organizers-notebook.org back to the repo.
*** TODO [[./subtitles/emacsconf-2020--00-opening-remarks-autogen.sbv]]
*** DONE sachac [[./subtitles/emacsconf-2020--03-idea-to-novel-superstructure-emacs-for-writing--bala-ramadurai-autogen.sbv]]
    CLOSED: [2020-12-10 Thu 11:21]
See [[file:info/03/screenplay.fountain]]
*** DONE sachac [[./subtitles/emacsconf-2020--04-music-in-plain-text--jonathan-gregory-autogen.sbv]]
    CLOSED: [2020-12-10 Thu 11:21]
*** DONE sachac [[./subtitles/emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--grant-shangreaux-autogen.sbv]]
    CLOSED: [2020-12-10 Thu 12:55]
*** DONE sachac [[./subtitles/emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--questions--grant-shangreaux-autogen.sbv]]
    CLOSED: [2020-12-10 Thu 14:22]
*** TODO sachac [[./subtitles/emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--questions--sid-kasivajhula-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--sid-kasivajhula-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--09-orgmode-your-life-in-plain-text--rainer-koenig-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--11-the-org-gtd-package-opinions-about-getting-things-done--aldric-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--12-one-big-ass-org-file-or-multiple-tiny-ones-finally-the-end-of-the-debate--leo-vivier-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--13-experience-report-steps-to-emacs-hyper-notebooks--joseph-corneli-raymond-puzio-cameron-ray-smith-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--14-readme-driven-design--adam-ard-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--15-moving-from-jekyll-to-orgmode-an-experience-report--adolfo-villafiorita-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--16-org-roam-presentation-demonstration-and-whats-on-the-horizon--leo-vivier-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--17-org-mode-and-org-roam-for-scholars-and-researchers--noorah-alhasan-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--18-org-roam-technical-presentation--leo-vivier-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--19-sharing-blogs-and-more-with-org-webring--brett-gilio-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--22-powering-up-special-blocks--musa-al-hassy-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--questions--tuan-anh-nguyen-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--tuan-anh-nguyen-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--25-traverse-complex-json-structures-with-live-feedback-counsel-jq--zen-monk-alain-m-lafon-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--pierce-wang-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--questions--pierce-wang-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--27-state-of-retro-gaming-in-emacs-chip8--vasilij-wasamasa-schneidermann-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--28-welcome-to-the-dungeon--erik-elmshauser-corwin-brust-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--30-a-tour-of-vterm--gabriele-bozzola-sbozzolo-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--30-a-tour-of-vterm--questions--gabriele-bozzola-sbozzolo-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--31-lakota-language-and-emacs--grant-shangreaux-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--31-lakota-language-and-emacs--questions--grant-shangreaux-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--32-object-oriented-code-in-the-gnus-newsreader--eric-abrahamsen-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.sbv]]
*** TODO [[./subtitles/emacsconf-2020--34-extend-emacs-to-modern-gui-applications-with-eaf--matthew-zeng-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--35-waveing-at-repetitive-repetitive-repetitive-music-zmusic--questions--zachary-kanfer-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--38-emacs-development-update--john-wiegley-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--39-nongnu-elpa--questions--richard-stallman-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--39-nongnu-elpa--richard-stallman-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--40-closing-remarks-part-1-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--40-closing-remarks-part-2-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--41-opening-remarks-autogen.sbv]]
*** TODO [[./subtitles/emacsconf-2020--42-closing-remarks-autogen.sbv]]
** DONE Create tasks for each of the subtitles
   CLOSED: [2020-12-09 Wed 15:42]
   :LOGBOOK:
   - State "DONE"       from "TODO"       [2020-12-09 Wed 15:42]
   :END:
** DONE Link compressed videos on each talk page
   CLOSED: [2020-12-09 Wed 15:42]
   :LOGBOOK:
   - State "DONE"       from "TODO"       [2020-12-09 Wed 15:42]
   :END:
#+begin_src emacs-lisp
  (mapc (lambda (o)
          (if (string-match "\\(emacsconf-2020--\\([0-9]+\\).*?\\)-vp9-q56-original-audio\\.webm" o)
              (let ((talk-id (match-string 2 o))
                    (base (match-string 1 o)))
                (find-file (expand-file-name (concat talk-id ".md") "~/vendor/emacsconf-wiki/2020/info"))
                (goto-char (point-min))
                (when (re-search-forward base nil t)
                  (forward-line 1)
                  (beginning-of-line)
                  (unless (looking-at "\\[Download")
                    (insert (format "[Download compressed %s.webm video (%s)](https://media.emacsconf.org/2020/%s)\n"
                                    (if (string-match "questions" o) "Q&A " "")
                                    (file-size-human-readable (file-attribute-size (file-attributes o)))
                                    (file-name-nondirectory o))))))))
        (directory-files "~/vendor/emacsconf-original-audio" t "webm"))
#+end_src
* Things to check or decide
- Can we stream from multiple rooms without getting thoroughly confused?
- Assign rooms shortly before presentation
  - *Shortly before presentation:* accommodates reshuffling

- Generating static images
  - Before the presentation: Talk title, speaker
  - Speaker checked in
  - After the presentation: pointer to main conference stream
  - After the conference: conference has ended, we'll take some time to prepare the recording
* Workflows
  
O1 - main organizer, O2 - secondary organizer or volunteer

*** Overview
 - Check in via IRC at #emacsconf-org
*** Before the conference
 - Do tech checks and get alternative ways to contact speakers (phone number? IRC nick? Something that goes ding?)
 - Install Mute Tab extension if desired
*** Start of streaming
 - O1 starts streaming
 - O2 starts low-resolution mirror (see infra.org in private wiki)
*** Tech check
 - Explain process
 - Test audio, webcam, screensharing, collaborative pad
 - Check if comfortable checking into IRC
 - Ask about Q&A preference; OR:
   - live Q&A
   - Q&A over pad or IRC
   - no Q&A
 - Get IRC nick and emergency contact information
 - Record name pronunciation
*** Shortly before the presentation
 - Speaker checks in via IRC
 - O2 directs speaker to available room
 - Speaker joins talk room
 - O2 makes speaker presenter and moderator, does tech check
 - Speaker tries screen sharing and webcam
 - O2 briefs speaker on process, including having the speaker say their name clearly and do a quick intro to their talk
 - O2 notifies O1 with link to the talk room
 - O1 joins meeting and gives go-ahead
 - O2 starts recording in BBB
 - O2 announces on IRC
*** During the presentation
 - OR:
   - Live presentation? 
     - Speaker presents, keeping an eye on the collaborative pad for questions
     - O1 stays with speaker to stream and to help with questions and timing
   - Prerecorded? O1 plays prerecorded video on computer
 - If there is another speaker, O2 moves to next room for setup
*** Q&A
 - O1 joins speaker's room if not already there
 - O1 gives go-ahead to start Q&A
 - Speaker reads questions off the pad or gets questions from O1
 - O1 goes to next talk when ready
*** Scenarios
**** Prerecorded presentations
- Amin will play it on his computer and stream from there
**** Tech issues
- If can't be easily resolved, play pre-recorded talk early and try again later (or follow up)
- Stream a technical issues slide to the end point

* During the conference
** ffmpeg: mirror main stream to low-resolution stream

 Needs the =$main480p= environment variable set to somethnig of the form =icecast://username:password@site:port/mount-point.webm=.

 #+begin_src sh :eval no
 while true; do ffmpeg -f webm -reconnect_at_eof 1 -reconnect_streamed 1  -re -i http://localhost:8000/main.webm -vf scale=854:480 -f webm -c:a copy -b:v 500k -maxrate 1M -bufsize 1M  -content_type video/webm -c:v libvpx  $main480p done
 #+end_src

** ERC
*** Load data

 #+begin_src emacs-lisp :var rooms=rooms :results silent
   (defvar conf/collaborative-pad "https://etherpad.wikimedia.org/p/emacsconf-2020" "URL of collaborative pad.")
   (defvar conf/topic-templates nil "List of (channel topic-template) entries for mass-setting channel topics.")
   (defvar conf/streaming-nick "bandali" "IRC nick of main organizer in charge of streaming.")
   "List of (code join-url) entries, one for each meeting room.")  ;; Set this in a private file
   (defvar conf/channels nil "List of IRC channels for broadcasts.")
   (defvar conf/info nil "List of plists with the following keys: `:talk-id', `:name', `:speakers', and other info.") ; Set from submissions.org
   (setq conf/topic-templates 
   '(("#emacsconf" "EmacsConf 2020 is over, thanks for joining! | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")
     ("#emacsconf-accessible" "EmacsConf 2020 is over. Thanks for making it more accessible! | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")
     ("#emacsconf-org" "EmacsConf2020 is over, thanks for joining! | Dedicated channel for EmacsConf organizers and speakers | this is intended as an internal, low-traffic channel; for main discussion around EmacsConf, please join #emacsconf | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")))
   (defvar conf/rooms '(("A" "http://example.org?room=a")
                        ("B" "http://example.org?room=b")
                        ("C" "http://example.org?room=c")) 
     "List of (code join-url) entries. Room codes should be uppercase.") ; set from organizers' wiki index.org
 #+end_src

*** Announce topics

 #+begin_src emacs-lisp
   (defmacro conf/erc-with-channels (channel-list &rest forms)
     (declare (indent 1) (debug (form form body)))
     `(mapcar (lambda (channel)
                (with-current-buffer (erc-get-buffer channel)
                  ,@forms))
              ,channel-list))

   (defun conf/get-room (room)
     (cadr (assoc (upcase room) conf/rooms)))

   (defun erc-cmd-CONFTOPIC (&rest message)
     "Set the topic to MESSAGE | template in the conference channels.
   If MESSAGE is not specified, reset the topic to the template."
     (mapc (lambda (template) 
             (with-current-buffer (erc-get-buffer (car template))
               (erc-cmd-TOPIC (if message (concat (if (stringp message) message (s-join " " message)) " | " (cadr template))
                                (cadr template)))))
           conf/topic-templates))

   (defun erc-cmd-CHECKIN (room nick)
     "Send instructions for ROOM and `conf/collaborative-pad' to NICK."
     (let ((room-url (conf/get-room room)))
       (unless room-url (error "Please specify nick and room name"))
       (erc-send-message (format "%s: Thanks for checking in! I'll send you some private messages with the instructions for room %s, so please check there. (Let me know if you don't get them!)" nick
       (upcase room)))
       (erc-message "PRIVMSG" (format "%s You can use this BBB room for your presentation: %s . I'll join you there shortly to set up the room and do the last-minute tech check." nick room-url))
       (erc-message "PRIVMSG" (format "%s The collaborative pad we'll be using for questions is at %s . We'll collect questions from #emacsconf and put them there. If you'd like to jump to your part of the document, you might be able to keep an eye on questions. Alternatively, we can read questions to you." nick conf/collaborative-pad))
       (erc-message "PRIVMSG" (format "%s Amin will join when it's time for your presentation, and he will give you the go-ahead when it's time to present. See you in the BBB room!" nick))))

   (defun erc-cmd-READY (code &rest filter)
     "Notify #emacsconf-org and `conf/streaming-nick' that CODE is ready for the talk specified by FILTER.
   FILTER can be the talk ID or strings to match against the title or speaker names."
     (let ((room-url (conf/get-room code))
           (talk (conf/find-talk filter)))
       (unless room-url (error "Could not find room"))
       (unless talk (error "Could not find talk"))
       (with-current-buffer (erc-get-buffer "#emacsconf-org")
         (erc-send-message (format "Ready in Room %s: %s (%s)"
                                   (upcase code)
                                   (plist-get talk :title)
                                   (plist-get talk :speakers))))
       (erc-message "PRIVMSG" 
                    (format "%s Ready in Room %s ( %s ): %s (%s)"
                            conf/streaming-nick
                            (upcase code)
                            room-url
                            (plist-get talk :title)
                            (plist-get talk :speakers)))))

   (defun erc-cmd-ANNOUNCE (&rest filter)
     "Set the channel topics to announce the talk specified by FILTER.
   FILTER can be the talk ID or strings to match against the title or speaker names."
     (let ((info (conf/find-talk filter)) message)
       (unless info (error "Could not find talk."))
       (erc-cmd-CONFTOPIC (format "talk%s: %s (%s)"
                                  (plist-get info :talk-id)
                                  (plist-get info :title)
                                  (plist-get info :speakers)))))

   (defun erc-cmd-BROADCAST (&rest message)
     "Say MESSAGE in all the conference channels."
     (conf/erc-with-channels conf/channels
                             (erc-send-message (s-join " " message))))
 #+end_src

* After the conference
* Splitting up the stream recording into individual files

NOTE: ffmpeg has a hard time splitting with -c:v copy unless it's on a
keyframe boundary. If it isn't on a keyframe, then you'll have a few
seconds of black video until the next keyframe kicks in.

Here's an example of what we had for splitting.

#+begin_src sh :eval no
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss   13:04 -to   20:08    -c:a copy -c:v copy emacsconf-2020--00-opening-remarks.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss   27:24 -to   51:39    -c:a copy -c:v copy emacsconf-2020--03-an-emacs-developer-story-from-user-to-package-maintainer--leo-vivier.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:00:08 -to 1:09:22    -c:a copy -c:v copy emacsconf-2020--03-idea-to-novel-superstructure-emacs-for-writing--questions--bala-ramadurai.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:41:28 -to 1:55:13    -c:a copy -c:v copy emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--questions--grant-shangreaux.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:57:24 -to 2:11:05    -c:a copy -c:v copy emacsconf-2020--06-trivial-emacs-kits--corwin-brust.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 2:32:00 -to 2:36:35    -c:a copy -c:v copy emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--questions--sid-kasivajhula.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 4:55:00 -to 5:11:38    -c:a copy -c:v copy emacsconf-2020--12-one-big-ass-org-file-or-multiple-tiny-ones-finally-the-end-of-the-debate--leo-vivier.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 5:47:44 -to 6:04:17    -c:a copy -c:v copy emacsconf-2020--15-moving-from-jekyll-to-orgmode-an-experience-report--adolfo-villafiorita.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 6:06:00 -to 6:27:56    -c:a copy -c:v copy emacsconf-2020--16-org-roam-presentation-demonstration-and-whats-on-the-horizon--leo-vivier.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 7:24:00 -to 7:27:09.50 -c:a copy -c:v copy emacsconf-2020--40-closing-remarks-part-1.webm
ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 7:28:00 -to 7:50:50    -c:a copy -c:v copy emacsconf-2020--20-omg-macros--corwin-brust.webm

ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss   15:40 -to   27:27    -c:a copy -c:v copy emacsconf-2020--41-opening-remarks.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss   34:48 -to 1:03:54.75 -c:a copy -c:v copy emacsconf-2020--22-powering-up-special-blocks--musa-al-hassy.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 1:30:40 -to 1:49:18    -c:a copy -c:v copy emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--questions--tuan-anh-nguyen.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 4:33:04 -to 4:37:30    -c:a copy -c:v copy emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--questions--pierce-wang.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 4:50:00 -to 5:59:30    -c:a copy -c:v copy emacsconf-2020--28-welcome-to-the-dungeon--erik-elmshauser-corwin-brust.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:08:20 -to 6:12:42.40 -c:a copy -c:v copy emacsconf-2020--30-a-tour-of-vterm--questions--gabriele-bozzola-sbozzolo.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:25:18 -to 6:31:04.90 -c:a copy -c:v copy emacsconf-2020--31-lakota-language-and-emacs--questions--grant-shangreaux.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:58:20 -to 7:20:38    -c:a copy -c:v copy emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:58:20 -to 7:20:38    -c:a copy -c:v copy emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 7:55:44 -to 8:02:02    -c:a copy -c:v copy emacsconf-2020--35-waveing-at-repetitive-repetitive-repetitive-music-zmusic--questions--zachary-kanfer.webm
ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 8:03:32 -to 8:40:01.10 -c:a copy -c:v copy emacsconf-2020--42-closing-remarks.webm
#+end_src

This fiddles with the =-ss= to make it divisible by 4. Run this code before a copy of the ffmpeg scripts (adjusting the value of adjust as needed) and it will show only the lines that need tweaking.

#+begin_src emacs-lisp :eval no
  (save-excursion
    (while (re-search-forward "^ffmpeg.*?-ss +\\([^ ]++?\\) +.*$" nil t)
      (let* ((adjust 4)
             (from (save-match-data
                    (let ((s (match-string 1)) num)
                      (if (string-match "\\(\\([0-9]+\\):\\)?\\([0-9]+\\):\\([0-9]+\\)\\(.[0-9]+\\)?" s)
                          (progn
                            (setq num
                                  (+ (* 3600 (string-to-number (or (match-string 2 s) "0")))
                                     (* 60 (string-to-number (or (match-string 3 s) "0")))
                                     (string-to-number (or (match-string 4 s) "0"))
                                     (string-to-number (concat "0" (or (match-string 5 s) "")))))
                            (if (> (% num adjust) 0)
                                (number-to-string (- num (% num adjust)))
                              nil))
                        s)))))
        (if from
            (replace-match from nil nil nil 1)
          (replace-match "")))))
#+end_src

Thanks to SirVolta and bandali for figuring out keyframe issue!

Further reading:

(all links work with LibreJS enabled)
https://blog.video.ibm.com/streaming-video-tips/keyframes-interframe-video-compression/
https://blog.streamspot.com/blog/compression-codecs-keyframes-and-the-basics-of-stream-quality
https://blog.superuser.com/2012/02/24/ffmpeg-the-ultimate-video-and-audio-manipulation-tool/
https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video
http://blog.webmproject.org/2010/05/inside-webm-technology-vp8-alternate.html


* Compressing video

Thanks to ArneBab for this ffmpeg script which is now documented in [[https://www.draketo.de/software/ffmpeg-compression-vp9-av1][Extreme compression of Video with VP9 (webm) using ffmpeg]]. We modified it to keep the original audio.

Usage: compress-video.sh input-filename.webm output-filename.webm

#+begin_src sh :tangle compress-video.sh
Q=56
nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -an -tile-columns 0 -tile-rows 0 -frame-parallel 0 -cpu-used 8 -auto-alt-ref 1 -lag-in-frames 25 -g 999 -pass 1 -f webm -threads 8 /dev/null &&
nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -c:a copy -tile-columns 2 -tile-rows 2 -frame-parallel 0 -cpu-used -5 -auto-alt-ref 1 -lag-in-frames 25 -pass 2 -g 999 -threads 8 $2
#+end_src

Here's the original version which compresses audio too. Usage: compress-video-compressed-audio.sh input-filename.webm output-filename.webm

#+begin_src sh :tangle compress-video-compressed-audio.sh
Q=56
nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -an -tile-columns 0 -tile-rows 0 -frame-parallel 0 -cpu-used 8 -auto-alt-ref 1 -lag-in-frames 25 -g 999 -pass 1 -f webm -threads 8 /dev/null &&
nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -c:a libopus -b:a 12k -tile-columns 2 -tile-rows 2 -frame-parallel 0 -cpu-used -5 -auto-alt-ref 1 -lag-in-frames 25 -pass 2 -g 999 -threads 8 $2
#+end_src

* Code sachac used to move sbv files from the Downloads directory

Autogenerated captions can save a bit of time when setting up
captions. This code renames a downloaded file to match the current
file's naming scheme and moves it to the right directory.

#+begin_src emacs-lisp
  (defvar conf/subtitle-directory (expand-file-name "subtitles" default-directory) "Directory where subtitles will be kept.")
  (defvar conf/download-directory "~/Downloads" "Directory where downloaded files are saved.")

  (defun my/latest-file (path &optional filter)
    "Returns the newest file in PATH.
  If FILTER is specified, files should match this regex."
    (car (sort (seq-remove #'file-directory-p (directory-files path 'full filter t)) #'file-newer-than-file-p)))
  (defun my/rename-latest-download-as-subtitle-file ()
    "Rename the most recent downloaded file to match the current file and move it to `conf/subtitle-directory'.
  To use this, open a Dired buffer with a list of the correctly-named
  videos. Move your cursor to the line for the video that you have just
  downloaded captions for, then call `my/rename-latest-download-as-subtitle-file.'"
    (interactive)
    (let* ((file (my/latest-file conf/download-directory))
           (new-file (expand-file-name (concat (file-name-base (dired-get-filename)) "-autogen." (file-name-extension file)) conf/subtitle-directory)))
      (rename-file file new-file t)
      (message "%s" new-file)))
  ;; Ex: (local-set-key [f5] 'my/rename-latest-download)
#+end_src

To convert from SBV to VTT (used for the HTML5 video player) and fix
timestamps so that they're not overlapping, install =python3-webtt=
and run [[file:subtitles/fix.py]] like this: =fix.py
emacsconf-2020--04-music-in-plain-text--jonathan-gregory.sbv=.

* Restarting ikiwiki manually

This is needed when you change the template or if the ikiwiki process gets stuck on something.

#+begin_src sh :eval no
ssh front 'sudo -iu ikiwiki ikiwiki --setup ~ikiwiki/emacsconf.setup'
#+end_src