Release status: stable
|Description||Provides integrated support for server side transcoding, WebM, Ogg Theora, Vorbis, MP3, Speex and Timed Text|
|Author(s)||Michael Dale, Jan Gerber, Tim Starling, James Heinrich, Brion Vibber, Derk-Jan Hartman|
|Latest version||0.5.0 (2015-12-08)|
|Compatibility policy||release branches|
|License||GNU General Public License 2.0 or later|
Translate the TimedMediaHandler extension if it is available at translatewiki.net
|Check usage and version matrix.|
|Open tasks · Report a bug|
The TimedMediaHandler extension 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 and an experimental VideoJS Player. There is support for subtitles and captions (aka Timed Text) and real time stream switching between multiple WebM and other derivatives and many other features. TMH server side support includes options for uploading HTML5 audio and video, multiple transcode profiles to deliver content, Metadata parsing for Ogg and WebM videos and integrates with MediaWiki's jobQueue system for scheduling transcoding jobs.
See Commons:Commons:TimedText page.
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 an end time of the form
end=1:30Which 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.
- 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
The player works on most modern browsers and supports IE9 and later (The modern browsers as described in MediaWiki's support matrix). Mobile support is spotty, especially on iOS.
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.
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). j^ supplies up-to-date static builds of ffmpeg with WebM support for major OSs at firefogg.org/nightly/
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
// TimedMediaHandler is dependent on mwEmbedSupport // MediaWiki 1.27 or earlier require_once "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php"; // After MediaWiki 1.27 wfLoadExtension( 'MwEmbedSupport' ); // TimedMediaHandler require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required.
- Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
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):
|Bitrate||Mbit/s||WebM VP8||WebM VP9|
|Max width (pixels)||288||426||640||854||1280||1920||288||426||640||854||1280||1920||2560||4096|
|Max height (pixels)||160||240||360||480||720||1080||160||240||360||480||720||1080||1440||2160|
|Sampling rate (Hz)||44100||48000|
Here are some configuration variables which may be useful:
// The minimum size for an embed video player ( smaller than this size uses a pop-up player ) $wgMinimumVideoPlayerSize = 200; // 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; // The total amout of time a transcoding shell command can take: $wgTranscodeBackgroundTimeLimit = 3600 * 8; // Maximum amount of virtual memory available to transcoding processes in KB $wgTranscodeBackgroundMemoryLimit = 2 * 1024 * 1024; // 2GB avconv, ffmpeg2theora mmap resources so virtual memory needs to be high enough // Maximum file size transcoding processes can create, in KB $wgTranscodeBackgroundSizeLimit = 3 * 1024 * 1024; // 3GB // Number of threads to use in avconv for transcoding $wgFFmpegThreads = 1; // The NS for TimedText (registered on MediaWiki.org) // https://www.mediawiki.org/wiki/Extension_namespace_registration // Note commons pre-dates TimedMediaHandler and should set $wgTimedTextNS = 102 in LocalSettings.php $wgTimedTextNS = 710; // Set TimedText namespace for ForeignDBViaLBRepo on a per wikiID basis // $wgTimedTextForeignNamespaces = array( 'commonswiki' => 102 ); $wgTimedTextForeignNamespaces = array(); /** * 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 uploaded * -Derivative should be listed min to max */ $wgEnabledTranscodeSet = array( WebVideoTranscode::ENC_WEBM_160P, WebVideoTranscode::ENC_WEBM_240P, WebVideoTranscode::ENC_WEBM_360P, WebVideoTranscode::ENC_WEBM_480P, WebVideoTranscode::ENC_WEBM_720P, WebVideoTranscode::ENC_WEBM_1080P, ); $wgEnabledAudioTranscodeSet = array( WebVideoTranscode::ENC_OGG_VORBIS, WebVideoTranscode::ENC_MP3, ); // If mp3 source assets can be ingested: $wgTmhEnableMp3Uploads = true; // If mp4 source assets can be ingested: $wgTmhEnableMp4Uploads = false;
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:
php maintenance/runJobs.php --type webVideoTranscode
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. You will need to install ffmpeg.
Minimal install under Ubuntu 16.04
apt-get install ffmpeg
|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.|