emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Audio/video file playback in org mode
@ 2011-06-09 21:55 Paul Sexton
  2011-06-09 22:22 ` Eric Schulte
  2011-06-10  8:28 ` Michael Brand
  0 siblings, 2 replies; 11+ messages in thread
From: Paul Sexton @ 2011-06-09 21:55 UTC (permalink / raw)
  To: emacs-orgmode

I have spent a few hours figuring this out so I thought I would post it for
the benefit of others.

I am learning a language, and wanted to include hyperlinks to audio files
within my org document, and be able to play each file by clicking on the
link. 

I eventually discovered the variable 'org-file-apps' which allows you to
associate particular applications with particular file types. 

I am using Bongo (https://github.com/dbrock/bongo) as the media player.
EMMS is another actively developed media player, but setup looked too 
complicated at first glance.

I am using MPlayer as the actual media player. This supports almost all 
audio and video file formats. Most importantly, it works on Windows as well
as on Linux (VLC has a Windows port but it doesn't work with Bongo as the
'fake-tty' interface is not implemented on Windows.)

My current setup means that clicking on a link such as [[file:song.mp3]] 
adds it to the active Bongo playlist (in another buffer) and immediately 
starts playing it. Playback can be paused, fast-forwarded etc using 
Bongo.

When Bongo plays a file it puts some icons in the modeline that
resemble the 'play', 'stop' etc symbols, and can be used to control
playback using the mouse. I found these worked erratically outside 
the actual Bongo playlist buffer, so I have instead bound some 
org-mode keys (ctrl + numpad keys) to the relevant functions.
This is optional of course.

I have only tested this with mp3 files, but it ought to work with
video as well.


My setup follows:
-------------------

;;; Part 1. Bongo setup

(add-to-list 'load-path "/path/to/bongo"))
(autoload 'bongo "bongo"
  "Start Bongo by switching to a Bongo buffer." t)

(setq bongo-mplayer-program-name
      (case system-type
        ((windows-nt cygwin) "c:\\Program Files\\MPlayer for Windows\\MPlayer.exe")
        (t "mplayer")))

(setq bongo-enabled-backends '(mplayer))

;;; Part 2. Org setup

(defvar av-file-regex
  (concat "\\." (regexp-opt
                 (append bongo-audio-file-name-extensions
                         bongo-video-file-name-extensions)) "$"))

(add-to-list 'org-file-apps
             (cons av-file-regex '(org-play-media-file file)))

(defun org-play-media-file (filename)
  (with-bongo-buffer
    (bongo-insert-file filename)
    (backward-char)
    (bongo-play)))

;;; Part 3. Keybindings to allow control of playback within Org buffer
;;; (optional)

;; Numpad Ctrl-0: pause/resume
(define-key org-mode-map (kbd "<C-kp-0>") 'bongo-pause/resume)
(define-key org-mode-map (kbd "<C-kp-insert>") 'bongo-pause/resume)
;; Numpad Ctrl-.: stop current track, or restart from beginning if stopped
(define-key org-mode-map (kbd "<C-kp-decimal>") 'bongo-start/stop)
(define-key org-mode-map (kbd "<C-kp-delete>") 'bongo-start/stop)
;; Numpad Ctrl-PgUp, Ctrl-PgDn: raise/lower volume
(define-key org-mode-map (kbd "<C-kp-prior>") 'bongo-volume-raise)
(define-key org-mode-map (kbd "<C-kp-next>") 'bongo-volume-lower)
(define-key org-mode-map (kbd "<C-kp-9>") 'bongo-volume-raise)
(define-key org-mode-map (kbd "<C-kp-3>") 'bongo-volume-lower)
;; Numpad Ctrl-left, Ctrl-right: skip back/forward 10 seconds
(define-key org-mode-map (kbd "<C-kp-left>") 'bongo-seek-backward-10)
(define-key org-mode-map (kbd "<C-kp-right>") 'bongo-seek-forward-10)
(define-key org-mode-map (kbd "<C-kp-4>") 'bongo-seek-backward-10)
(define-key org-mode-map (kbd "<C-kp-6>") 'bongo-seek-forward-10)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-09 21:55 Audio/video file playback in org mode Paul Sexton
@ 2011-06-09 22:22 ` Eric Schulte
  2011-06-10  8:28 ` Michael Brand
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Schulte @ 2011-06-09 22:22 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode

Very cool,

Would you mind posting this to Worg to increase that chances that it
will be found by future Orgers?

The first place that comes to mind is the org-hacks page at
http://orgmode.org/worg/org-hacks.html

Cheers -- Eric

Paul Sexton <psexton@xnet.co.nz> writes:

> I have spent a few hours figuring this out so I thought I would post it for
> the benefit of others.
>
> I am learning a language, and wanted to include hyperlinks to audio files
> within my org document, and be able to play each file by clicking on the
> link. 
>
> I eventually discovered the variable 'org-file-apps' which allows you to
> associate particular applications with particular file types. 
>
> I am using Bongo (https://github.com/dbrock/bongo) as the media player.
> EMMS is another actively developed media player, but setup looked too 
> complicated at first glance.
>
> I am using MPlayer as the actual media player. This supports almost all 
> audio and video file formats. Most importantly, it works on Windows as well
> as on Linux (VLC has a Windows port but it doesn't work with Bongo as the
> 'fake-tty' interface is not implemented on Windows.)
>
> My current setup means that clicking on a link such as [[file:song.mp3]] 
> adds it to the active Bongo playlist (in another buffer) and immediately 
> starts playing it. Playback can be paused, fast-forwarded etc using 
> Bongo.
>
> When Bongo plays a file it puts some icons in the modeline that
> resemble the 'play', 'stop' etc symbols, and can be used to control
> playback using the mouse. I found these worked erratically outside 
> the actual Bongo playlist buffer, so I have instead bound some 
> org-mode keys (ctrl + numpad keys) to the relevant functions.
> This is optional of course.
>
> I have only tested this with mp3 files, but it ought to work with
> video as well.
>
>
> My setup follows:
> -------------------
>
> ;;; Part 1. Bongo setup
>
> (add-to-list 'load-path "/path/to/bongo"))
> (autoload 'bongo "bongo"
>   "Start Bongo by switching to a Bongo buffer." t)
>
> (setq bongo-mplayer-program-name
>       (case system-type
>         ((windows-nt cygwin) "c:\\Program Files\\MPlayer for Windows\\MPlayer.exe")
>         (t "mplayer")))
>
> (setq bongo-enabled-backends '(mplayer))
>
> ;;; Part 2. Org setup
>
> (defvar av-file-regex
>   (concat "\\." (regexp-opt
>                  (append bongo-audio-file-name-extensions
>                          bongo-video-file-name-extensions)) "$"))
>
> (add-to-list 'org-file-apps
>              (cons av-file-regex '(org-play-media-file file)))
>
> (defun org-play-media-file (filename)
>   (with-bongo-buffer
>     (bongo-insert-file filename)
>     (backward-char)
>     (bongo-play)))
>
> ;;; Part 3. Keybindings to allow control of playback within Org buffer
> ;;; (optional)
>
> ;; Numpad Ctrl-0: pause/resume
> (define-key org-mode-map (kbd "<C-kp-0>") 'bongo-pause/resume)
> (define-key org-mode-map (kbd "<C-kp-insert>") 'bongo-pause/resume)
> ;; Numpad Ctrl-.: stop current track, or restart from beginning if stopped
> (define-key org-mode-map (kbd "<C-kp-decimal>") 'bongo-start/stop)
> (define-key org-mode-map (kbd "<C-kp-delete>") 'bongo-start/stop)
> ;; Numpad Ctrl-PgUp, Ctrl-PgDn: raise/lower volume
> (define-key org-mode-map (kbd "<C-kp-prior>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-next>") 'bongo-volume-lower)
> (define-key org-mode-map (kbd "<C-kp-9>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-3>") 'bongo-volume-lower)
> ;; Numpad Ctrl-left, Ctrl-right: skip back/forward 10 seconds
> (define-key org-mode-map (kbd "<C-kp-left>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-right>") 'bongo-seek-forward-10)
> (define-key org-mode-map (kbd "<C-kp-4>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-6>") 'bongo-seek-forward-10)
>
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-09 21:55 Audio/video file playback in org mode Paul Sexton
  2011-06-09 22:22 ` Eric Schulte
@ 2011-06-10  8:28 ` Michael Brand
  2011-06-10 16:10   ` brian powell
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Michael Brand @ 2011-06-10  8:28 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode

Hi Paul

Thank you very much for sharing this, I will benefit a lot and the
interactivity from within Emacs seems extremely useful. My recent
searches for how to play an Org link to an audio file didn't find any
result and I was about to work out something with mpg123. I planned to
define a new link type for this but your solution with "file:" looks
to me more like it should be and is also backwards compatible with
links already made with "file:".

And even better if "file:" could also cover my requirement to have an
optional link search part that lets the player start and stop at a
specified time. Let me define the format like this:
- start to play in file at 00:03:21, stop at 00:06:54:
  [[file:some_podcast.mp3::00:03:21-00:06:54]]
- start to play in file at 00:03:21, play until end of file:
  [[file:some_podcast.mp3::00:03:21]]
- play the whole file:
  [[file:some_podcast.mp3]]

I would like to explicitly not allow [[file:some_podcast.mp3::03:21]]
as a shorter option with MM:SS because I would like to see XX:XX being
reserved for HH:MM without exception in Org. There was a recent
discussion covering this in the context of time calculation:
http://thread.gmane.org/gmane.emacs.orgmode/39487/focus=39840

Michael

On Thu, Jun 9, 2011 at 23:55, Paul Sexton <psexton@xnet.co.nz> wrote:
> I have spent a few hours figuring this out so I thought I would post it for
> the benefit of others.
>
> I am learning a language, and wanted to include hyperlinks to audio files
> within my org document, and be able to play each file by clicking on the
> link.
>
> I eventually discovered the variable 'org-file-apps' which allows you to
> associate particular applications with particular file types.
>
> I am using Bongo (https://github.com/dbrock/bongo) as the media player.
> EMMS is another actively developed media player, but setup looked too
> complicated at first glance.
>
> I am using MPlayer as the actual media player. This supports almost all
> audio and video file formats. Most importantly, it works on Windows as well
> as on Linux (VLC has a Windows port but it doesn't work with Bongo as the
> 'fake-tty' interface is not implemented on Windows.)
>
> My current setup means that clicking on a link such as [[file:song.mp3]]
> adds it to the active Bongo playlist (in another buffer) and immediately
> starts playing it. Playback can be paused, fast-forwarded etc using
> Bongo.
>
> When Bongo plays a file it puts some icons in the modeline that
> resemble the 'play', 'stop' etc symbols, and can be used to control
> playback using the mouse. I found these worked erratically outside
> the actual Bongo playlist buffer, so I have instead bound some
> org-mode keys (ctrl + numpad keys) to the relevant functions.
> This is optional of course.
>
> I have only tested this with mp3 files, but it ought to work with
> video as well.
>
>
> My setup follows:
> -------------------
>
> ;;; Part 1. Bongo setup
>
> (add-to-list 'load-path "/path/to/bongo"))
> (autoload 'bongo "bongo"
>  "Start Bongo by switching to a Bongo buffer." t)
>
> (setq bongo-mplayer-program-name
>      (case system-type
>        ((windows-nt cygwin) "c:\\Program Files\\MPlayer for Windows\\MPlayer.exe")
>        (t "mplayer")))
>
> (setq bongo-enabled-backends '(mplayer))
>
> ;;; Part 2. Org setup
>
> (defvar av-file-regex
>  (concat "\\." (regexp-opt
>                 (append bongo-audio-file-name-extensions
>                         bongo-video-file-name-extensions)) "$"))
>
> (add-to-list 'org-file-apps
>             (cons av-file-regex '(org-play-media-file file)))
>
> (defun org-play-media-file (filename)
>  (with-bongo-buffer
>    (bongo-insert-file filename)
>    (backward-char)
>    (bongo-play)))
>
> ;;; Part 3. Keybindings to allow control of playback within Org buffer
> ;;; (optional)
>
> ;; Numpad Ctrl-0: pause/resume
> (define-key org-mode-map (kbd "<C-kp-0>") 'bongo-pause/resume)
> (define-key org-mode-map (kbd "<C-kp-insert>") 'bongo-pause/resume)
> ;; Numpad Ctrl-.: stop current track, or restart from beginning if stopped
> (define-key org-mode-map (kbd "<C-kp-decimal>") 'bongo-start/stop)
> (define-key org-mode-map (kbd "<C-kp-delete>") 'bongo-start/stop)
> ;; Numpad Ctrl-PgUp, Ctrl-PgDn: raise/lower volume
> (define-key org-mode-map (kbd "<C-kp-prior>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-next>") 'bongo-volume-lower)
> (define-key org-mode-map (kbd "<C-kp-9>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-3>") 'bongo-volume-lower)
> ;; Numpad Ctrl-left, Ctrl-right: skip back/forward 10 seconds
> (define-key org-mode-map (kbd "<C-kp-left>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-right>") 'bongo-seek-forward-10)
> (define-key org-mode-map (kbd "<C-kp-4>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-6>") 'bongo-seek-forward-10)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-10  8:28 ` Michael Brand
@ 2011-06-10 16:10   ` brian powell
  2011-06-11  4:57     ` Paul Sexton
  2011-06-11  4:53   ` Paul Sexton
       [not found]   ` <4DF2F3B6.2030400@xnet.co.nz>
  2 siblings, 1 reply; 11+ messages in thread
From: brian powell @ 2011-06-10 16:10 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2722 bytes --]

* Something like this; respectively!?:

[[shell:mplayer -ss 00:03:21 -endpos 00:06:54 ~/some_podcast.mp3 &]]

[[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]]

[[shell:mplayer ~/some_podcast.mp3 &]]

VLC works great for this too.

[[file:...] works too of course, but you have to make a "file association"
(or like mentioned: 'org-file-apps') to mplayer or emacs OrgMode will just
open the file in a buffer.

Unclear about statement about earlier posts: "I would like to explicitly not
allow..."

P.S. Thanks for the link to BONGO--the EMACS "buffer media player".
I made my own "buffer media player" and have used it for many years; but,
BONGO.el is wayly kuul too!


On Fri, Jun 10, 2011 at 4:28 AM, Michael Brand
<michael.ch.brand@gmail.com>wrote:

> Hi Paul
>
> Thank you very much for sharing this, I will benefit a lot and the
> interactivity from within Emacs seems extremely useful. My recent
> searches for how to play an Org link to an audio file didn't find any
> result and I was about to work out something with mpg123. I planned to
> define a new link type for this but your solution with "file:" looks
> to me more like it should be and is also backwards compatible with
> links already made with "file:".
>
> And even better if "file:" could also cover my requirement to have an
> optional link search part that lets the player start and stop at a
> specified time. Let me define the format like this:
> - start to play in file at 00:03:21, stop at 00:06:54:
>  [[file:some_podcast.mp3::00:03:21-00:06:54]]
> - start to play in file at 00:03:21, play until end of file:
>  [[file:some_podcast.mp3::00:03:21]]
> - play the whole file:
>  [[file:some_podcast.mp3]]
>
> I would like to explicitly not allow [[file:some_podcast.mp3::03:21]]
> as a shorter option with MM:SS because I would like to see XX:XX being
> reserved for HH:MM without exception in Org. There was a recent
> discussion covering this in the context of time calculation:
> http://thread.gmane.org/gmane.emacs.orgmode/39487/focus=39840
>
> Michael
>
> On Thu, Jun 9, 2011 at 23:55, Paul Sexton <psexton@xnet.co.nz> wrote:
> > I have spent a few hours figuring this out so I thought I would post it
> for
> > the benefit of others.
> >
> > I am learning a language, and wanted to include hyperlinks to audio files
> > within my org document, and be able to play each file by clicking on the
> > link.
> >
> > I eventually discovered the variable 'org-file-apps' which allows you to
> > associate particular applications with particular file types.
> >
> > I am using Bongo (https://github.com/dbrock/bongo) as the media player.
> > EMMS is another actively developed media player, but setup looked too
> > complicated at first glance.
>

[-- Attachment #2: Type: text/html, Size: 3711 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-10  8:28 ` Michael Brand
  2011-06-10 16:10   ` brian powell
@ 2011-06-11  4:53   ` Paul Sexton
       [not found]   ` <4DF2F3B6.2030400@xnet.co.nz>
  2 siblings, 0 replies; 11+ messages in thread
From: Paul Sexton @ 2011-06-11  4:53 UTC (permalink / raw)
  To: emacs-orgmode

Thanks Michael, I'm glad you think it will be helpful. I have implemented
something like what you have requested here. I have hived this code off 
into a separate file called org-player.el.

You can get it at:

http://bitbucket.org/eeeickythump/org-player/

I intend to add it to worg in the next little while.

Links can now contain times to start playback, as follows:

[[file:/path/to/song.mp3::2:43]]      Starts playback at 2 min 43 sec.
[[file:/path/to/song.mp3::1:10:45]]   Starts playback at 1 hr 10 min 45 sec.
[[file:/path/to/song.mp3::3m15s]]     Starts playback at 3 min 15 sec.
[[file:/path/to/song.mp3::49s]]       Starts playback at 0 min 49 sec.
[[file:/path/to/song.mp3::1h21m10s]]  Starts playback at 1 hr 21 min 10 sec.

As you see I have made XX:YY mean minutes and seconds, as it seems more 
logical to me for this particular purpose. If there is a compelling reason 
to interpret XX:YY as hours and minutes in these links then I am not totally
 opposed to changing it, but I think many people would find it confusing and 
counterintuitive.

In all cases playback continues until the end of the file. I couldn't find 
a way to implement playback of 'snippets' with a specified start and end 
time, unfortunately.

Cheers
Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-10 16:10   ` brian powell
@ 2011-06-11  4:57     ` Paul Sexton
  2011-06-11 14:00       ` Memnon Anon
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Sexton @ 2011-06-11  4:57 UTC (permalink / raw)
  To: emacs-orgmode

brian powell <briangpowellms <at> gmail.com> writes:


> * Something like this; respectively!?: 
> 
> [[shell:mplayer -ss 00:03:21 -endpos 00:06:54 ~/some_podcast.mp3 &]]
> [[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]]
> [[shell:mplayer ~/some_podcast.mp3 &]]

The troubles with using shell commands in hyperlinks:
1. Only works in the operating system and directory structure where
   you were when you wrote the link;
2. No ability to stop playback, pause, etc, unless you run the
   program as a GUI, which means (horror!) doing something outside 
   Emacs.

> VLC works great for this too.

In windows VLC works as a shell command, but doesn't work with Bongo.

> P.S. Thanks for the link to BONGO--the EMACS "buffer media player".
> I made my own "buffer media player" and have used it for many years; but,
BONGO.el is wayly kuul too!

You're welcome. Are you aware of EMMS, it seems to be Bongo's main rival (I
haven't tried it).

Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
       [not found]   ` <4DF2F3B6.2030400@xnet.co.nz>
@ 2011-06-11  6:23     ` Michael Brand
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Brand @ 2011-06-11  6:23 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode

Hi Paul

On Sat, Jun 11, 2011 at 06:48, Paul Sexton <psexton@xnet.co.nz> wrote:
> Thanks Michael, I'm glad you think it will be helpful. I have implemented
> something like what you have requested here. I have hived this code off into
> a separate file called org-player.el.
>
> You can get it at:
>
> http://bitbucket.org/eeeickythump/org-player/

Thank you very much for sharing. It worked out of the box to play an
Org link with time spec and I like it.

> I intend to add it to worg in the next little while.

That would be great. I first misread it to be added to Org core, but
maybe later after some more user feedback.

> Links can now contain times to start playback, as follows:
>
> [[file:/path/to/song.mp3::2:43]]      Starts playback at 2 min 43 sec.
> [[file:/path/to/song.mp3::1:10:45]]   Starts playback at 1 hr 10 min 45 sec.
> [[file:/path/to/song.mp3::3m15s]]     Starts playback at 3 min 15 sec.
> [[file:/path/to/song.mp3::49s]]       Starts playback at 0 min 49 sec.
> [[file:/path/to/song.mp3::1h21m10s]]  Starts playback at 1 hr 21 min 10 sec.
>
> As you see I have made XX:YY mean minutes and seconds, as it seems more
> logical to me for this particular purpose. If there is a compelling reason
> to interpret XX:YY as hours and minutes in these links then I am not totally
> opposed to changing it, but I think many people would find it confusing and
> counterintuitive.

Ok, in the context of a media file your arguments convinced me.

> In all cases playback continues until the end of the file. I couldn't find a
> way to implement playback of 'snippets' with a specified start and end time,
> unfortunately.

I'm sure this is only a question of time, I'll try to solve this too.

Michael

> On 10/06/2011 8:28 p.m., Michael Brand wrote:
>>
>> Hi Paul
>>
>> Thank you very much for sharing this, I will benefit a lot and the
>> interactivity from within Emacs seems extremely useful. My recent
>> searches for how to play an Org link to an audio file didn't find any
>> result and I was about to work out something with mpg123. I planned to
>> define a new link type for this but your solution with "file:" looks
>> to me more like it should be and is also backwards compatible with
>> links already made with "file:".
>>
>> And even better if "file:" could also cover my requirement to have an
>> optional link search part that lets the player start and stop at a
>> specified time. Let me define the format like this:
>> - start to play in file at 00:03:21, stop at 00:06:54:
>>   [[file:some_podcast.mp3::00:03:21-00:06:54]]
>> - start to play in file at 00:03:21, play until end of file:
>>   [[file:some_podcast.mp3::00:03:21]]
>> - play the whole file:
>>   [[file:some_podcast.mp3]]
>>
>> I would like to explicitly not allow [[file:some_podcast.mp3::03:21]]
>> as a shorter option with MM:SS because I would like to see XX:XX being
>> reserved for HH:MM without exception in Org. There was a recent
>> discussion covering this in the context of time calculation:
>> http://thread.gmane.org/gmane.emacs.orgmode/39487/focus=39840

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-11  4:57     ` Paul Sexton
@ 2011-06-11 14:00       ` Memnon Anon
  2011-06-11 23:55         ` Alan E. Davis
  0 siblings, 1 reply; 11+ messages in thread
From: Memnon Anon @ 2011-06-11 14:00 UTC (permalink / raw)
  To: emacs-orgmode

Paul Sexton <psexton@xnet.co.nz> writes:

> brian powell <briangpowellms <at> gmail.com> writes:
>
>
>> * Something like this; respectively!?: 
>> 
>> [[shell:mplayer -ss 00:03:21 -endpos 00:06:54 ~/some_podcast.mp3 &]]
>> [[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]]
>> [[shell:mplayer ~/some_podcast.mp3 &]]
>
> The troubles with using shell commands in hyperlinks:
> 1. Only works in the operating system and directory structure where
>    you were when you wrote the link;
> 2. No ability to stop playback, pause, etc, unless you run the
>    program as a GUI, which means (horror!) doing something outside 
>    Emacs.

If you are using different setups on different operating systems, 1)
should probably be solved in some general fashion, like setting some 
vars to important locations depending on environmentearly in your .emacs.

2.) 
    [[elisp:(emms-play-file "~/tmp/video/magit.flv")]]
or 
    [[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))]]
or
[[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))][View magit demo]]

Of course, there is no problem with setting up org to treat file links to
mediafiles special. But given the power of org hyperlinks, I think using
"elisp:" solves your 1.) and 2.) sufficiently.

Memnon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-11 14:00       ` Memnon Anon
@ 2011-06-11 23:55         ` Alan E. Davis
  2011-06-12  8:23           ` Christian Moe
  0 siblings, 1 reply; 11+ messages in thread
From: Alan E. Davis @ 2011-06-11 23:55 UTC (permalink / raw)
  To: Memnon Anon; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3457 bytes --]

I'll jump in and mention a solution to an at least similar problem I hacked,
albeit incompletely, some time ago.  I baldly stole code from
"dired-mplayer" at http://www.emacswiki.org/cgi-bin/wiki/EMMS#toc10 , and
have been using the result, "dired-vlc" ever since.   The main point of this
was to play videos asynchronously, so I could continue editing, taking notes
using the relative timer of org-mode.

Two more things would make this process work better, at least for me:

   1. write a few lines into this that would open another buffer, possibly
through capture, starting the relative timer automagically.
   2. figure out how to pause the video and the timer simultaneously.

Here is the code to dired-vlc.  I am not interested in making this work for
windows, have no idea whether it would, or how to make it do so.

#+BEGIN_EXAMPLE
;;  -*- mode: elisp -*-
;; Time-stamp: <2009-01-13 14:27:47 orm>
;; AED 05 January 2009
;;;;;;;;;;;;;;;;;

(require 'org)


(defvar dired-vlc-program "/usr/bin/vlc")


(defun dired-vlc (&optional timer)
  "Asynchronously start vlc on file through dired.  If an optional
argument is given (C-u), the org relative timer is started.  This
function purports to start vlc in rc mode, to leave open the
possibility of remote control."
  (interactive "P")
  (let ((file (expand-file-name (dired-get-filename)))
        ext files basename dir curr-file ;idx-file sub-file srt-file
    command options)
    (setq basename (file-name-nondirectory
            (file-name-sans-extension file)))
    (setq dir (file-name-directory file))
    (setq files (directory-files dir t basename))
    (delete file files)
    (setq command (format "\"%s\" \"%s" dired-vlc-program "--intf rc"))
    (if (y-or-n-p (format "Run command %s?" command))
        (start-process "junk" nil dired-vlc-program file)))
  (if (equal timer '(4)) (org-timer-start))
)


;; end dired-vlc.el
#+END_EXAMPLE

I am interested in what you are doing, also, and I will try it out in a
month or two, after I retire and relocate.

Alan Davis

On Sun, Jun 12, 2011 at 12:00 AM, Memnon Anon <
gegendosenfleisch@googlemail.com> wrote:

> Paul Sexton <psexton@xnet.co.nz> writes:
>
> > brian powell <briangpowellms <at> gmail.com> writes:
> >
> >
> >> * Something like this; respectively!?:
> >>
> >> [[shell:mplayer -ss 00:03:21 -endpos 00:06:54 ~/some_podcast.mp3 &]]
> >> [[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]]
> >> [[shell:mplayer ~/some_podcast.mp3 &]]
> >
> > The troubles with using shell commands in hyperlinks:
> > 1. Only works in the operating system and directory structure where
> >    you were when you wrote the link;
> > 2. No ability to stop playback, pause, etc, unless you run the
> >    program as a GUI, which means (horror!) doing something outside
> >    Emacs.
>
> If you are using different setups on different operating systems, 1)
> should probably be solved in some general fashion, like setting some
> vars to important locations depending on environmentearly in your .emacs.
>
> 2.)
>    [[elisp:(emms-play-file "~/tmp/video/magit.flv")]]
> or
>    [[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))]]
> or
> [[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))][View magit
> demo]]
>
> Of course, there is no problem with setting up org to treat file links to
> mediafiles special. But given the power of org hyperlinks, I think using
> "elisp:" solves your 1.) and 2.) sufficiently.
>
> Memnon
>
>
>

[-- Attachment #2: Type: text/html, Size: 4485 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-11 23:55         ` Alan E. Davis
@ 2011-06-12  8:23           ` Christian Moe
  2011-06-12  9:34             ` Michael Brand
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Moe @ 2011-06-12  8:23 UTC (permalink / raw)
  To: Alan E. Davis; +Cc: Memnon Anon, emacs-orgmode

Hi,

>     1. write a few lines into this that would open another buffer,
> possibly through capture, starting the relative timer automagically.
>     2. figure out how to pause the video and the timer simultaneously.

As it happens, I've been sitting on some code to do just that, meaning 
to post it when I got all the bugs out. Which, needless to say, I 
haven't. But I'll clean it up and post to this thread shortly, since 
it's a hot topic.

Yours,
Christian

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Audio/video file playback in org mode
  2011-06-12  8:23           ` Christian Moe
@ 2011-06-12  9:34             ` Michael Brand
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Brand @ 2011-06-12  9:34 UTC (permalink / raw)
  To: Alan E. Davis, mail; +Cc: emacs-orgmode

Hi Alan and Christian

On Sun, Jun 12, 2011 at 01:55, Alan E. Davis <lngndvs@gmail.com> wrote:
> The main point of this
> was to play videos asynchronously, so I could continue editing, taking notes
> using the relative timer of org-mode.

Thank you for this cool idea.

On Sun, Jun 12, 2011 at 10:23, Christian Moe <mail@christianmoe.com> wrote:
On Sun, Jun 12, 2011 at 01:55, Alan E. Davis <lngndvs@gmail.com> wrote:
>> Two more things would make this process work better, at least for me:
>>
>>    1. write a few lines into this that would open another buffer,
>> possibly through capture, starting the relative timer automagically.
>>    2. figure out how to pause the video and the timer simultaneously.
>
> As it happens, I've been sitting on some code to do just that, meaning to
> post it when I got all the bugs out. Which, needless to say, I haven't. But
> I'll clean it up and post to this thread shortly, since it's a hot topic.

Only as a collection of ideas: Even better if the Org relative timer
would not start/stop by user interaction and count the time on its own
but if the Org relative timer in this case would "only" just be
replaced by reading the current play time from the media player
through the same mechanisms that already update the current play time
for display in Emacs. Then the note taking time would also stay in
sync with fast forward and rewind. Useful e. g. when searching a
certain time in a paused audio file that loops in place. And if the
point in the note taking buffer would even move up and down - when
enabled - when an already taken note is passed by time from fast
forward or rewind this would be neat.

Michael

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-06-12  9:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 21:55 Audio/video file playback in org mode Paul Sexton
2011-06-09 22:22 ` Eric Schulte
2011-06-10  8:28 ` Michael Brand
2011-06-10 16:10   ` brian powell
2011-06-11  4:57     ` Paul Sexton
2011-06-11 14:00       ` Memnon Anon
2011-06-11 23:55         ` Alan E. Davis
2011-06-12  8:23           ` Christian Moe
2011-06-12  9:34             ` Michael Brand
2011-06-11  4:53   ` Paul Sexton
     [not found]   ` <4DF2F3B6.2030400@xnet.co.nz>
2011-06-11  6:23     ` Michael Brand

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).