Extension:TimedMediaHandler/zh

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 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.

功能概览
查看Commons:Commons:TimedText页面.

语法简介
在image embed syntax基础上，Timed Media Handler支持：


 * Video.ogv
 * 用原尺寸显示一个视频. 显示一个在视频中点提取的静止图像，和一个用来激活播放器的播放按钮.


 * Audio.oga
 * 为声音文件显示一个占位符，包含一个用于激活播放器的播放按钮.


 * Video.ogv
 * 在一个浮动的缩略图里显示视频.


 * 在一个图片库（image gallery）里嵌入视频（每一个截图都会弹出一个用于完整视频的对话框）.
 * 在一个图片库（image gallery）里嵌入视频（每一个截图都会弹出一个用于完整视频的对话框）.


 * Video.ogg
 * 用1分25秒的一帧画面插入视频作为占位图形. 一个单独的数字将默认被理解成秒数.


 * 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.


 * 已弃用
 * 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

客户端支持


这个播放器在大部分现代浏览器上能够工作，支持IE9及更高版本（在MediaWiki's support matrix里有关于现代浏览器的描述）. 移动端支持情况不一，尤其是在iOS上.

As of August 2015, TimedMediaHandler includes a 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.

安装
请同时看来了解详细安装指南.

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/

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

维基百科媒体编码选项的比较
Sorted by bandwidth tier (grayed items are not currently enabled):

详细选项:

配置
这里展示了配置用变量和它们的默认值：

如果需要转码，请确认你的$wgMaxShellMemory, $wgMaxShellTime, $wgMaxShellFileSize足够大而保证转码工作进行并保存输出. 默认值很可能太小了.

进行转码工作
由于转码工作是资源集中型工作，它们不会再常规工作队列中运行 ( 查看 bug 29336 ). 取而代之的是，它们必须在--类型变量里被要求.

编码节点
为了能够转码许多视频，你可能想要运行多个连接到主数据库并且直接访问你的文件的编码节点. 如果你在使用ubuntu lucid (10.04) ，你需要添加this ppa并且安装php5-cli php-pear imagemagick ffmpeg ffmpeg2theora.

在 Ubuntu 12.04 系统中的最小安装
add-apt-repository ppa:j/timedmediahandler apt-get install php5-cli php-pear imagemagick ffmpeg ffmpeg2theora

在Localsettings.php文件中，添加PEAR的文件路径！

路线图

 * ✅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 (T115170)
 * ✅ Audio transcoding to mp3 and ogg (T165717)
 * Add support for IE9 video tag WebM components
 * ✅ Add support for 1080p videos
 * ✅ *新增支持4k视频.
 * 新增支持8k视频.
 * 升级到2.x branch. (On hold. Planning on switching to video.js.)
 * Change Kaultra player to Video.js as our main video player.

备注
These notes about the status of TimedMediaHandler were shared by Jan Gerber at the end of his consulting agreement for WMF on 27 September, 2013:

Since you asked in the last meeting to write up an overview of the current state of TimedMediaHandler, here we go:


 * videoscalers:
 * setup like jobrunners, but only processing video transcode jobs (configuration of jobs/memory/threads in puppet and wikimedia-config)


 * imagescalers:
 * extract frames from videos, using avconv for all videos reading videos via http from swift backend


 * proxy caches:
 * must support HTTP 206 Range Requests for video urls (currently requires custom code that is managed in puppet)


 * custom packages for video transcoding (apt.wikimedia.org):
 * ffmpeg2theora (new upstream version to reduce memory by only using one thread)
 * libav (ubuntu version with patch to fix memory leak in ogg decoder)
 * libvpx (new upstream version fixing various issues and quality improvements)


 * custom packages for image scaling (apt.wikimedia.org):
 * vips (new upstream version addressing various performance issues)


 * TimedMediaHandler:
 * Upstream coded included in TMH:
 * mwEmbed (https://github.com/kaltura/mwEmbed) has local changes needs to be merged during next update
 * PEAR File_Ogg (http://pear.php.net/package/File_Ogg) has local changes was part of OggHandler, Tim is upstream maintainer
 * getID3 (http://getid3.org) has small local changes but merged upstream


 * Statistics and monitoring:
 * Transcoding queue and errors:
 * https://commons.wikimedia.org/wiki/Special:TimedMediaHandler
 * https://commons.wikimedia.org/wiki/User:Dispenser/sandbox


 * Ganglia for video scalers:
 * http://ganglia.wikimedia.org/latest/?r=hour&cs=&ce=&s=by+name&c=Video%2520scalers%2520eqiad&tab=m&vn=

2015年8月更新
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)
 * 支持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

另见

 * ReviewQueue
 * Test Plan