Release status: beta
|Description||Integrated support for server side transcoding, WebM, Ogg Theora, Vorbis, Speex and Timed Text|
|Author(s)||Michael Dale, Jan Gerber, Tim Starling|
|Check usage and version matrix|
|Bugs: list open list all report|
TimedMediaHandler is an extension which allows you to display audio and video files in wiki pages, using the same syntax as for image files. It includes the Kaltura HTML5 Player, which supports integrated standard timed text support, real time stream switching between multiple WebM and Ogg derivatives and many other features. TMH server side support includes multiple transcode profiles, php based medata parsing via PEAR Ogg / OggHandler and getID3 for WebM files, and integrates with mediaWiki's jobQueue system for scheduling transcoding jobs.
Feature Overview 
Syntax synopsis 
In addition to the image embed syntax, Timed Media Handler supports:
- Display a video at its nominal size. Displays a still image from the midpoint with a play button to start an embedded player.
- Show a placeholder for a sound file, with a play button to start an embedded player.
- 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 )
- 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.
- 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 and end time of the form end=1:30 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.
Client support 
Also see the README 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 firefogg.org/nightly/
To install this extension, add the following to the end of your LocalSettings.php:
// TimedMediaHandler is dependent on mwEmbedSupport require( "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php" ); // TimedMediaHandler require( "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php" );
This extension also requires schema changes, so run update.php after installing.
Comparison of Wikipedia media encoding options 
|Max width (pixels)||288||640||854||1280||640||854||1280|
|Max height (pixels)||160||360||480||720||360||480||720|
|Sampling rate (Hz)||44100|
Here are the configuration variables and their default settings:
// Show a warning to the user if they are not using an html5 browser with high quality ogg support $wgMwEmbedModuleConfig['EmbedPlayer.DirectFileLinkWarning'] = true; // The text interface should always be shown // ( even if there are no text tracks for that asset at render time ) $wgMwEmbedModuleConfig['TimedText.ShowInterface'] = 'always'; // Which users can restart failed or expired transcode jobs $wgGroupPermissions['sysop']['transcode-reset'] = true; // How long you have to wait between transcode resets for non-error transcodes $wgWaitTimeForTranscodeReset = 3600; // The minimum size for an embed video player: $wgMinimumVideoPlayerSize = 200; // Set the supported ogg codecs: $wgMediaVideoTypes = array( 'Theora', 'VP8' ); $wgMediaAudioTypes = array( 'Vorbis', 'Speex', 'FLAC' ); // Default skin for mwEmbed player ( class attribute of video tag ) $wgVideoPlayerSkin = 'kskin'; // Support iframe for remote embedding $wgEnableIframeEmbed = true; // If transcoding is enabled for this wiki ( if disabled, no transcode jobs are added and no // transcode status is displayed. Note if remote embedding an asset we will still check if // the remote repo has transcoding enabled and associated flavors for that media embed. $wgEnableTranscode = true; // If the job runner should run transcode commands in a background thread and monitor the // transcoding progress. This enables more fine grain control of the transcoding process, wraps // encoding commands in a lower priority 'nice' call, and kills long running transcodes that are // not making any progress. If set to false, the job runner will use the more compatible // php blocking shell exec command. $wgEnableNiceBackgroundTranscodeJobs = true; // The priority to be used with the nice transcode commands. $wgTranscodeBackgroundPriority = 19; // The total amout of time a transcoding shell command can take: $wgTranscodeBackgroundTimeLimit = 3600 * 4; // The location of ffmpeg2theora ( transcoding ) $wgFFmpeg2theoraLocation = '/usr/bin/ffmpeg2theora'; // Location of the FFmpeg binary ( used to encode WebM and for thumbnails ) $wgFFmpegLocation = '/usr/bin/ffmpeg'; // The NS for TimedText ( registered on mediawiki.org ) // http://www.mediawiki.org/wiki/Extension_namespace_registration // Note commons pre-dates TimedMediaHandler and should set $wgTimedTextNS = 102 in localSettings.php $wgTimedTextNS = 700; /** * Default enabled transcodes * * -If set to empty array, no derivatives will be created * -Derivative keys encode settings are defined in WebVideoTranscode.php * * -These transcodes are *in addition to* the source file. * -Only derivatives with smaller width than the source asset size will be created * -Regardless of source size at least one WebM and Ogg source will be created from the $wgEnabledTranscodeSet * -Derivative jobs are added to the MediaWiki JobQueue the first time the asset is displayed * -Derivative should be listed min to max */ $wgEnabledTranscodeSet = array( // A high end web streamable ogg video WebVideoTranscode::ENC_OGV_480P, // A web low bandwidth streamable WebM video WebVideoTranscode::ENC_WEBM_360P, // A web streamable WebM video WebVideoTranscode::ENC_WEBM_480P, // A high quality WebM stream WebVideoTranscode::ENC_WEBM_720P, );
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 27336 ) Instead they must be requested by the --type argument:
php runJobs.php --type webVideoTranscode
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 this ppa and install php5-cli php-pear imagemagick ffmpeg ffmpeg2theora.
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 and audio transcoding to mp3 and ogg. ( Off by default until mp3 patents expire in 2012 )
- Add support for IE9 video tag WebM components
Wikimedia status 
|This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page.|