embedding videos in sphinx

7,247 views
Skip to first unread message

Nils Wagner

unread,
Sep 12, 2014, 5:54:42 AM9/12/14
to sphinx-users
Hi all,

Just out of curiosity is it possible to embed videos such as *.avi, *.mp4, *.wmv in
documents generated by sphinx ?

A working example is appreciated.

Nils

David Carroll

unread,
Sep 13, 2014, 7:59:03 AM9/13/14
to sphinx...@googlegroups.com
An embedded video. Note that you will need to add the http: in front of the video url after you paste it from YouTube. (see source)
.. raw:: html

    <iframe width="560" height="315" src="http://www.youtube.com/embed/6Dakd7EIgBE?rel=0" frameborder="0" allowfullscreen></iframe>

Takayuki Shimizukawa

unread,
Sep 14, 2014, 10:19:53 PM9/14/14
to sphinx...@googlegroups.com
Hi,

For embedding youtube video, you can use sphinxcontrib-youtube
https://bitbucket.org/birkenfeld/sphinx-contrib/src/49a8e96bc8a7/youtube/
(it is not registered to PyPI, then you need install it by hand)

For local video files, you can use `.. raw:: html` directive.
1. Put video files into _static directory
2. write <video> tag with `.. raw:: html` directive.

Regards,
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sphinx-users...@googlegroups.com.
> To post to this group, send email to sphinx...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

nil...@googlemail.com

unread,
Sep 15, 2014, 7:36:21 AM9/15/14
to sphinx...@googlegroups.com
Hi,

I have successfully installed sphinxcontrib-youtube. It works fine for me !

However, I am mainly interested in the second approach,
Please can you provide a working example how to handle local video files ?

Thanks in advance.

Regards,
                     Nils

Takayuki Shimizukawa

unread,
Sep 15, 2014, 8:13:49 AM9/15/14
to sphinx...@googlegroups.com
Hi Nils,

2014-09-15 20:36 GMT+09:00 nil...@googlemail.com <nil...@googlemail.com>:
> Hi,
>
> I have successfully installed sphinxcontrib-youtube. It works fine for me !
>
> However, I am mainly interested in the second approach,
> Please can you provide a working example how to handle local video files ?

I'm not familiar to HTML5, but it works for me:

.. raw:: html

<video controls src="_static/yoga.mp4"></video>


> Thanks in advance.
>
> Regards,
> Nils

Nils Wagner

unread,
Sep 15, 2014, 8:29:26 AM9/15/14
to sphinx-users
Hi,

I have still some trouble. The video is not copied into the corresponding directory within build/html directory.
Is the path to yoga.mp4 a relative path ? Why do I need _static ?

Any idea ?

Cheers,
              Nils


--
You received this message because you are subscribed to a topic in the Google Groups "sphinx-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sphinx-users/_z00m3zoRAY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sphinx-users...@googlegroups.com.

Takayuki Shimizukawa

unread,
Sep 15, 2014, 8:54:33 AM9/15/14
to sphinx...@googlegroups.com
Hi,

Yes, <video src="_static/yoga.mp4"> is specified with relative path.
Because sphinx don't know the video tag in the raw directive, you need
specify the correct location by hand.

And I put 'yoga.mp4' into _static directory because _static directory
will be copied into _build/html/_static directory.

Regards,
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa


> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Nils Wagner

unread,
Sep 15, 2014, 11:07:03 AM9/15/14
to sphinx-users
Hi,

Works for me. Thank you very much !

Regards,

Nils

Reply all
Reply to author
Forward
0 new messages