yuchen-lea / org-media-note

Taking interactive notes when watching videos or listening to audios in org-mode.
GNU General Public License v3.0
241 stars 35 forks source link
audio note-taking org-mode video

[[file:README_CN.org][中文文档]]

[[file:CHANGELOG.org][Changelog]]

📚 Working with [[https://github.com/jkitchin/org-ref][org-ref]] to get a better experience:

Open related media file in org-ref note,play on top,insert current timestamp and subtitle

[[../demo/org-media-note-add.gif?raw=true]]

Insert current screenshot. Also, you can customize to auto insert screenshot when create a new note item [[../demo/org-media-note-screenshot.gif?raw=true]]

Jump to the right position by clicking link [[../demo/org-media-note-follow.gif?raw=true]]

Open online video, then operate the same as local files! [[../demo/org-media-note-online-video-en.gif?raw=true]]

Now, you can access all functions in =org-media-note-show-interface=.

ℹ️ Here, I use Hyper key =H= for keybinding. In this way, I can quickly access personal functions, and no major or minor modes will stamp on my keys. Look into this for more information: [[http://ergoemacs.org/emacs/emacs_hyper_super_keys.html][Emacs: How to Bind Super Hyper Keys]]. Or you can bind it to any other key you like. After all, it's Emacs ;)

All functions are accessible via =org-media-note-show-interface=. Depending on the value of the =org-media-note-interface=, =org-media-note-pretty-hydra/body= or =org-media-note-transient= will be called:

** pretty-hydra ui [[../demo/org-media-note-hydra.png?raw=true]]

ℹ️ Corresponding function is in the brackets. Those without brackets usually call mpv commands directly. More info refers =org-media-note-pretty-hydra=.

** transient ui

The transient interface has the same functions and key bindings as the pretty-hydra interface.

To accommodate a more compact layout, config commands are semantically grouped:

[[../demo/org-media-note-transient.png?raw=true]]

** transient vs pretty-hydra

The interactive logic is consistent. If a shortcut key that is not within the interface is typed, the interface will exit and the corresponding command will be executed.

| | transient | pretty-hydra | |---------------------+-----------------------------------------------+-------------------------------------------| | Dependency | Built-in since Emacs 28 | [[https://github.com/jerrypnz/major-mode-hydra.el][pretty-hydra]] | | Appearance Position | Depends on =transient-display-buffer-action= | Bottom of the current frame | | ui | [[../demo/org-media-note-transient.png?raw=true]] | [[../demo/org-media-note-hydra.png?raw=true]] |

Using org-media-note for online video notes relies on mpv's streaming feature and requires additional external dependencies. It requires the installation of [[https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#installation][yt-dlp]] to download videos from websites. You can find the list of supported websites [[https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md][here]]. yt-dlp is smoother and more powerful than youtube-dl, which is the default used by mpv. If you want to play online videos but haven't installed yt-dlp, org-media-note will raise an error.

Settings can be applied in several places, with priority from low to high:

  1. =mpv.conf= file: General settings for mpv.
  2. =org-media-note-mpv-general-options= variable: General settings in org-media-note. The default value specifies using yt-dlp for downloads.
  3. =org-media-note-mpv-online-website-options-alist= variable: Individual settings for websites, for example, Bilibili needs to download all subtitles and danmaku, while YouTube's auto-generated subtitles only need to download specific languages. Please modify according to actual conditions, see [[https://github.com/yuchen-lea/org-media-note/wiki/org%E2%80%90media%E2%80%90note%E2%80%90mpv%E2%80%90online%E2%80%90website%E2%80%90options%E2%80%90alist-demo][org-media-note-mpv-online-website-options-alist demo]] and  [[https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp][FAQ · yt-dlp/yt-dlp Wiki]].
  4. =org-media-note-mpv-webstream-download-path= variable: Download directory for online video subtitles and other files. Default is temporary folder. If set to nil, it will download to the current directory.

As long as you can normally load subtitles in mpv, org-media-note can control playback, insert timestamps and screenshots, and even import subtitles just like with local media!

The following image demonstrates playing a Bilibili video, danmaku navigation, switching subtitles, importing subtitles, and other functions: [[../demo/org-media-note-online-video-en.gif?raw=true]]

The extension is essentially a wrapper around the functionality of mpv. If mpv cannot play properly, you can call =org-media-note-copy-mpv-command= to copy the mpv command, then paste it into the terminal and check if it works.