Video documents

From EPrints Documentation
Revision as of 14:55, 15 October 2016 by (talk | contribs) (Video Players)
Jump to: navigation, search

This page is in development and will eventually contain information about supporting Video documents in EPrints.

Related Pages

Video Transcoding by EPrints/FFMPEG

Summary of video codec support on browsers: By default, EPrints performs the following tasks when generating "thumbnails" for videos, using FFMPEG:

  • generate an image thumbnail
  • transcode video to ogg container
  • transcode video to mp4 container

Video Document Integration

Should the video player be integrated as an iframe embed code, document "preview" link, or embedded directly on the abstract page? Most recent version of EdShare generates a video player directly on the abstract page, rather than a popup "preview" window as in Kultur plugin. It is also possible to embed a video player (typically with an iframe) to stream content from another site, like YouTube and Vimeo.

Video Players

Depositors can upload video documents. Since EPrints 3.3, there is a flowplayer in EPrints, under /lib/static/. However, EPrints does not embed any video player as a "preview" thumbnail or on the abstract page. To generate a video player for a document in EPrints, the Kultur plugin ( can be used to extend the preview with a video player.

Video.js Integration

One solution is to integrate video.js with EPrints. Following these instructions: Integration involves adding the following to the <head> of the template (globally, in /archives/ARCHIVEID/cfg/lang/LANGID/templates/default.xml)

<link href="" rel="stylesheet"/>
<!-- If you'd like to support IE8 -->
<script src=""></script>

and the following right before the last closing </body> tag:

<script src=""></script>

Generating the video player can be done in, as follows:

#TN - render a video player for video documents
my $type = "";
my $videoDiv = $session->make_element( "div" );
$type = $doc->get_type;		
if ($type eq "video"){
	my $video_preview_image = $doc->thumbnail_url("preview");
	my $videomimetype_1="video/mp4";
	my $video_preview_1 = $doc->thumbnail_url("video_mp4");
	my $videomimetype_2="video/ogg";
	my $video_preview_2 = $doc->thumbnail_url("video_ogg");

	if ($video_preview_1 || $video_preview_2){
		my $videoplayer = $session->make_element( "video", id=>"my-video", class=>"video-js", controls=>"", preload=>"auto", poster=>$video_preview_image, 'data-setup'=>"{}" );
		if ($video_preview_1){
			my $source_1 = $session->make_element ("source", src=>$video_preview_1, type=>$videomimetype_1);
			$videoplayer->appendChild( $source_1 );
		if ($video_preview_2){
			my $source_2 = $session->make_element ("source", src=>$video_preview_2, type=>$videomimetype_2);
			$videoplayer->appendChild( $source_2 );
		my $nojsP = $session->make_element ("p", class=>"vjs-no-js");
		my $nojstext = "To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video";
		$nojsP->appendChild( $session->make_text( $nojstext) );
		$videoplayer->appendChild( $nojsP );
#$videoDiv now holds the video player, and can be added to the page with appendChild($videoDiv)

Server Settings

The following file should contain a path to ffmpeg and ffprobe:


ffmpeg should be installed on the server. On some servers (Ubuntu), 'libx264' needs to be installed for the H264 codec.