Extension:TimedMediaHandler

The TimedMediaHandler extension allows you to display audio and video files in wiki pages, using the same syntax as for images>Special:MyLanguage/Help:Images|image files. It includes the [http://html5video.org/wiki/Kaltura_HTML5_Video_Player Kaltura HTML5 Player] and an experimental VideoJS Player. There is support for subtitles and captions (aka Timed Text) and real time stream switching between multiple WebM and Ogg derivatives and many other features. TMH server side support includes options for uploading HTML5 audio and video, multiple transcode profiles to deliver content, Medata parsing for Ogg and WebM videos and integrates with mediaWiki's jobQueue system for scheduling transcoding jobs.

Feature Overview
See Commons:Commons:TimedText page.

Syntax synopsis
In addition to the img-syntax>Special:MyLanguage/Help:Images#Syntax|image embed syntax, Timed Media Handler supports:


 * Video.ogv
 * Display a video at its nominal size. Displays a still image from the midpoint with a play button to start an embedded player.


 * Audio.oga
 * Show a placeholder for a sound file, with a play button to start an embedded player.


 * Video.ogv
 * Show a video in a floating thumbnail box


 * Show a video embedded in an image gallery ( each clip will popup a dialog for the full player )
 * Show a video embedded in an image gallery ( each clip will popup a dialog for the full player )


 * Video.ogg
 * Use a frame from 1 minute 25 seconds into the video as the placeholder image. A single number is taken as an offset in seconds.


 * Video.ogg
 * Temporal media fragments Displays a video clip starting at 1 minute 25 seconds into the video. A single number is taken as an offset in seconds. You can also include an end time of the form  Which would result in a clip of 5 seconds playing from 1:25 to 1:30. If thumbtime is not provided, the start time will be used for the displayed thumbnail.


 * Deprecated
 * The syntax words noicon and noplayer are deprecated and do not function. The keyword disablecontrols will likely be deprecated soon.  It takes the following values: options, timedText, fullscreen

Client support


The player works on most modern browsers and supports IE9 and later (The modern browsers as described in compat>Special:MyLanguage/Compatibility#Browser　support　matrix|MediaWiki's support matrix).

Mobile support is spotty, especially on iOS.

As of August 2015, TimedMediaHandler includes a ogv>Special:MyLanguage/Extension:TimedMediaHandler/ogv.js|JavaScript compatibility shim for Ogg audio/video that works in Safari, Internet Explorer 10/11, and Microsoft Edge browsers.

Third-party users of MediaWiki may also wish to manually enable MP4 H.264/AAC support for native video and audio playback in Safari/IE/Edge, but when using these formats you may need a patent license from MPEG-LA for internet broadcasting.

Installation
Also see the  for detailed install instructions.

You will want a recent version of ffmpeg in order to support encoding to WebM ( with the latest version of VP8) and a copy of ffmpeg2theora to encode ogg videos. j^ supplies up-to-date static builds of ffmpeg with WebM support and of ffmpeg2theora for major OSs at [http://firefogg.org/nightly/ firefogg.org/nightly/]

The extension will automatically add supported file types (except mp4) to $wgFileExtensions, so you do not need to manually add video file types.

Comparison of Wikipedia media encoding options
Sorted by bandwidth tier (grayed items are not currently enabled):

Detailed options:

Configuration
Here are the configuration variables and their default settings:

For transcoding, make sure you have $wgMaxShellMemory, $wgMaxShellTime, $wgMaxShellFileSize are large enough to allow encoding jobs to run and save output. Default values are most likely too low.

Running transcode jobs
Because transcode jobs are resource intensive they will not run as part of normal job queue ( see bug 29336 ) Instead they must be requested by the --type argument:

Encoding nodes
To be able to transcode many videos you might want to run multiple encoding nodes that connect to the master db and access your file store directly. If you are using ubuntu lucid (10.04) you should add [https://launchpad.net/~j/+archive/timedmediahandler this ppa] and install php5-cli php-pear imagemagick ffmpeg ffmpeg2theora.

Minimal install under Ubuntu 12.04
add-apt-repository ppa:j/timedmediahandler apt-get install php5-cli php-pear imagemagick ffmpeg ffmpeg2theora

In Localsettings.php, add the path for PEAR !

Road Map

 * Add api module for listing of derivatives ( done in TimedMediaHandler )
 * Add support for transcoding from arbitrary format uploads.
 * Improve transcoding tracking with database tables for registering failed transcodes, time taken per transcode, allow users to flag files as not playable or a visually broken transcodes.
 * Improve mobile support for uploading and playback ( via native aps if the browser html5 support does not include WebM )
 * Add support for WebM flattening of edited sequences
 * Add support for mp3 uploads
 * Audio transcoding to mp3 and ogg
 * Add support for IE9 video tag WebM components
 * Add support for 1080p videos
 * Add support for 4k videos


 * Add support for 8k videos


 * Upgrade to 2.x branch. (On hold. Planning on switching to video.js.)


 * Change Kaultra player to Video.js as our main video player.

August 2015 update
Brion and TheDJ are starting up some new maintenance on TImedMediaHandler:

Done:
 * fixed some regressions in transcode handling
 * added /ogv.js JavaScript compatibility shim for Safari 6.1+, IE 10/11, and Edge
 * increasing Ogg transcode quality (increased bandwidth)


 * support subtitles in ogv.js


 * finish killing broken Cortado Java compatibility shim


 * retooling TMH's ResourceLoader modules for better compatibility


 * fix ogv.js issues
 * missing volume control

Todo 'small':
 * fix more transcode issues

Todo 'medium':
 * get transcoding from VP9/Opus working on Wikimedia servers...
 * transcoding to VP9/Opus WebM with decreased bandwidth
 * add Ogg skeleton to ogg audio transcodes for better seeking
 * integrate lightweight video player into Extension:MobileFrontend


 * rework serving Timed Text

Todo 'large':
 * replace Kaltura player with VideoJS
 * integrate video player into Extension:MultimediaViewer
 * integrate audio/video into Extension:VisualEditor
 * DASH or DASH-like adaptive streaming

Todo 'long-term':
 * get VP9 working fast enough on ogv.js to replace Ogg Theora transcodes