/ol-mpv

Org custom link for video timestamps played in mpv

Primary LanguageEmacs Lisp

ol-mpv

org hyperlink for various video timestamps. It provides link type that can specify time stamp of the video.

Features

This only supports :follow functionality.

I’ve tried to implement :export before, but I’m ending up with giving up as there’s no way to access property drawer in export phase.

If you have good idea for support them, please open new issue and let me know.

Usage

1. Set up URI in property

ol-mpv uses OL_MPV_URI property with it. Set it to URI that you want to associated with:

* Some headline
:PROPERTIES:
:OL_MPV_URI: https://www.youtube.com/watch?v=mtbAUMzBWbE
:END:

2. Write timestamp as link

Then, you can write timestamp as a link. You can write it just like you do in YouTube comment.

mpv:01:00

mpv:01:00
[[mpv:01:00][Link at 1 minute]]
[[mpv:01][Link at 1 second]]
[[mpv:01:00:00][Link at 1 hour]]
[[mpv:1:00][Link at 1 minute without first 0]]
[[mpv:1][Link at 1 second without first 0]]
[[mpv:1:00:00][Link at 1 hour without first 0]]

3. Spawn mpv by open any link in there first time

When you open the link with help:org-open-at-point, it will spawn mpv if it’s not spawned yet.

4. open link to change time position

When you open the link next time, it will change time position.

Supported video URIs

As this program uses mpv directly, all URIs supported by mpv are available (not tested though).

For example:

  • https://
  • file:// (*this is discouraged, use normal path instead)
  • rtmp://
  • fd://

for list of all files, please execute the command below:

mpv --list-protocols | grep '://$' | sort | uniq

or visit https://mpv.io/manual/master/#protocols

For debugging

If you have some problem with mpv, you might better to investigate its output.

To do so, replace :buffer property of make-process with some buffer, and remove "--no-terminal" Option from :command. (You can use string instead of buffer object, in which case it’ll create buffer with that name if it isn’t exist yet.)

  (let ((mpv-proc (make-process
		:name (format "ol-mpv mpv [%s]" video-uri)
- 	      :buffer nil
+ 	      :buffer "BUFFER_NAME_YOU_WANT"
		:sentinel 'ol-mpv/mpv/sentinel
		:connection-type 'pipe
		:command `("mpv"
- 			 "--no-terminal"
			   ,(format "--title=%s" (ol-mpv/mpv-WM-title video-uri))
			   "--no-input-terminal"
			   "--input-ipc-client=fd://0"
			   ,video-uri
			   ))))

This patch is for version 1.0.0, it might be changed in the future.