Video Output Types

This module defines the rich output types for video formats.

class sage.repl.rich_output.output_video.OutputVideoAvi(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

AVI video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoAvi
sage: OutputVideoAvi.example()
OutputVideoAvi container
class sage.repl.rich_output.output_video.OutputVideoBase(video, loop=True)

Bases: sage.repl.rich_output.output_basic.OutputBase

Abstract base class for rich video output

INPUT:

  • videoOutputBuffer. The video data.
  • loop – boolean. Whether to repeat the video in an endless loop.

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg
sage: OutputVideoOgg.example()  # indirect doctest
OutputVideoOgg container
classmethod example()

Construct a sample video output container

This static method is meant for doctests, so they can easily construct an example. The method is implemented in the abstract OutputVideoBase class, but should get invoked on a concrete subclass for which an actual example can exist.

OUTPUT:

An instance of the class on which this method is called.

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg
sage: OutputVideoOgg.example()
OutputVideoOgg container
sage: OutputVideoOgg.example().video
buffer containing 5612 bytes
sage: OutputVideoOgg.example().ext
'.ogv'
sage: OutputVideoOgg.example().mimetype
'video/ogg'
html_fragment(url, link_attrs='')

Construct a HTML fragment for embedding this video

INPUT:

  • url – string. The URL where the data of this video can be found.
  • link_attrs – string. Can be used to style the fallback link which is presented to the user if the video is not supported.

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg
sage: print(OutputVideoOgg.example().html_fragment
....:       ('foo', 'class="bar"').replace('><','>\n<'))
<video autoplay="autoplay" controls="controls" loop="loop">
<source src="foo" type="video/ogg" />
<p>
<a target="_new" href="foo" class="bar">Download video/ogg video</a>
</p>
</video>
class sage.repl.rich_output.output_video.OutputVideoFlash(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

Flash video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoFlash
sage: OutputVideoFlash.example()
OutputVideoFlash container
class sage.repl.rich_output.output_video.OutputVideoMatroska(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

Matroska Video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoMatroska
sage: OutputVideoMatroska.example()
OutputVideoMatroska container
class sage.repl.rich_output.output_video.OutputVideoMp4(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

MPEG 4 video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoMp4
sage: OutputVideoMp4.example()
OutputVideoMp4 container
class sage.repl.rich_output.output_video.OutputVideoOgg(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

Ogg video, Ogg Theora in particular

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg
sage: OutputVideoOgg.example()
OutputVideoOgg container
class sage.repl.rich_output.output_video.OutputVideoQuicktime(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

Quicktime video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoQuicktime
sage: OutputVideoQuicktime.example()
OutputVideoQuicktime container
class sage.repl.rich_output.output_video.OutputVideoWebM(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

WebM video

The video can be encoded using VP8, VP9 or an even more recent codec.

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoWebM
sage: OutputVideoWebM.example()
OutputVideoWebM container
class sage.repl.rich_output.output_video.OutputVideoWmv(video, loop=True)

Bases: sage.repl.rich_output.output_video.OutputVideoBase

Windows Media Video

EXAMPLES:

sage: from sage.repl.rich_output.output_catalog import OutputVideoWmv
sage: OutputVideoWmv.example()
OutputVideoWmv container