Extension:TimedMediaHandler
TimedMediaHandler リリースの状態: 安定 |
|
---|---|
![]() |
|
実装 | メディア, API |
説明 | サーバー側のトランスコード、WebM、Ogg Theora、Vorbis、MP3、Speex、Timed Textの統合サポートを提供 |
作者 | Michael Dale, Jan Gerber, Tim Starling, James Heinrich, Brion Vibber, Derk-Jan Hartman |
最新バージョン | 0.6.0 (2018-11-07) |
互換性ポリシー | Snapshots releases along with MediaWiki. Master is not backwards compatible. |
MediaWiki | 1.29+ |
PHP | 5.6+ |
データベースの変更 | はい |
テーブル | transcode |
ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
ダウンロード | |
|
|
|
|
|
|
translatewiki.net で翻訳を利用できる場合は、TimedMediaHandler 拡張機能の翻訳にご協力ください | |
問題点 | 未解決のタスク · バグを報告 |
TimedMediaHandler拡張機能を使用すると、画像ファイルと同じ構文を使用して、ウィキページにオーディオおよびビデオファイルを表示できます。 それには HTML5 プレーヤーと実験的な VideoJS プレーヤーが含まれています。 字幕やキャプション (別名 Timed Text) や複数の WebM と他の派生物間のリアルタイム ストリームの切り替えなどの機能があります。 TMH サーバー サイドのサポートには、HTML5 の音声と動画、複数のトランスコード プロファイルをアップロードするオプション、Ogg 動画と WebM 動画のためのメタデータ構文解析、トランスコード ジョブのスケジューリングのための MediaWiki の jobQueue システムが組み込まれています。
機能の概要
Commons:Commons:Timed Textページを参照してください。
構文の概要
In addition to the image embed syntax, Timed Media Handler supports:
- [[File:Video.ogv|File: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.
- [[File:Audio.oga|File:Audio.oga]]
- サウンドファイルのプレースホルダを表示し、埋め込みプレーヤーを開始するための再生ボタンを表示します。
- [[File:Midi.mid]]
- Generate digital audio from the music instructions in the MIDI file, and show the embedded audio player to play this audio.
- [[File:Video.ogv|thumb]]
- Show a video in a floating thumbnail box
- <gallery>File:Video.ogv</gallery>
- Show a video embedded in an image gallery (each clip will popup a dialog for the full player)
- [[File:Video.ogg|thumbtime=1:25]]
- 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. One can also use HH:MM:SS, e.g. 1:02:22 will be 1 hour, 2 minutes, and 22 seconds into the video.
- [[File:Video.ogg|start=1:25]]
- 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: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. One can also use HH:MM:SS, e.g. 1:02:22 will be 1 hour, 2 minutes, and 22 seconds into the video. start=
andend=
can also be used as query parameters in the URL for a video's file page.- 廃止予定
- The syntax words noicon and noplayer are deprecated and do not function. The keyword disablecontrols will likely be deprecated. (See Task 135537) It takes a comma-separated list of any of the following values: options, timedText, fullscreen
サポートされるブラウザー
プレーヤーは最新のブラウザで動作し、IE9以降をサポートしています(MediaWikiのサポートマトリックスで説明されているモダンブラウザ)。 特にiOSでは、モバイルサポートには問題があります。
2015年8月現在、TimedMediaHandlerには、Safari、Internet Explorer 10/11、およびMicrosoft Edgeブラウザで動作するOggオーディオ/ビデオ用のJavaScript互換シムが含まれています。
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). j^ supplies up-to-date static builds of ffmpeg with WebM support for major OSs at firefogg.org/nightly/. See the sections below for installation instructions on older versions of MediaWiki.
- ダウンロードして、ファイルを
extensions/
フォルダー内のTimedMediaHandler
という名前のディレクトリ内に配置します。 - Git でのインストールの場合のみ、PHP の依存関係をインストールするため Composer を実行します。 (See タスク T173141 for potential complications.)
- 以下のコードを LocalSettings.php の末尾に追加します:
// MediaWiki 1.31 and later wfLoadExtension( 'TimedMediaHandler' ); $wgFFmpegLocation = '/usr/bin/ffmpeg'; // Most common ffmpeg path on Linux
- 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベース テーブルを自動的に作成します。
- Configure as required.
- You may need to increase the allowed memory in $wgMaxShellMemory .
完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
The extension will automatically add supported file types (except for mp4) to $wgFileExtensions , so you do not need to manually add video file types.
After downloading this extension, please note that it requires Composer.
So, after installation change to the directory containing the extension e.g. "../extensions/TimedMediaHandler/" and run composer install --no-dev
, or when updating: composer update --no-dev
.
Alternatively as well as preferably add the line "extensions/TimedMediaHandler/composer.json"
to the "composer.local.json" file in the root directory of your wiki like e.g.
{
"extra": {
"merge-plugin": {
"include": [
"extensions/TimedMediaHandler/composer.json"
]
}
}
}
ウィキペディアのメディアエンコードオプションの比較
See Extension:TimedMediaHandler/VP9 transition for deployment details on planned Wikimedia update from VP8 to VP9.
Sorted by bandwidth tier (grayed items are not currently enabled):
Bitrate | Mbit/s | WebM VP8 | WebM VP9 |
---|---|---|---|
Super Low | 0.08 | 160p | |
Very Low | 0.16 | 160p | 240p |
Low | 0.25 | 240p | 360p |
Moderate | 0.5 | 360p | 480p |
Medium | 1.0 | 480p | 720p |
High | 2.0 | 720p | 1080p |
Very high | 4.0 | 1080p | 1440p |
Super high | 8.0 | 2160p |
詳細なオプション:
名前 | 160P | 240P | 360P | 480P | 720P | 1080P | 160P | 240P | 360P | 480P | 720P | 1080P | 1440P | 2160P | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
コンテナー | WebM | ||||||||||||||
動画 | エンコード | VP8 | VP9 | ||||||||||||
フレーム幅 (ピクセル) | 288 | 426 | 640 | 854 | 1280 | 1920 | 288 | 426 | 640 | 854 | 1280 | 1920 | 2560 | 4096 | |
フレーム高 (ピクセル) | 160 | 240 | 360 | 480 | 720 | 1080 | 160 | 240 | 360 | 480 | 720 | 1080 | 1440 | 2160 | |
ビットレート (Mbit/s) | 0.16 | 0.25 | 0.5 | 1.0 | 2.0 | 4.0 | 0.08 | 0.16 | 0.25 | 0.5 | 1.0 | 2.0 | 4.0 | 8.0 | |
音声 | エンコード | Vorbis | Opus | ||||||||||||
チャンネル | 2 (stereo) | (pass-through) | |||||||||||||
サンプリング レート (Hz) | 44100 | 48000 | |||||||||||||
品質 | - | 1 | 2 | 3 | - | (default) |
設定
![]() | このページは直近の情報を反映していません。 |
以下は有用な設定用の変数です:
// 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
*/
// Starting from 1.31
// All valid string values are listed in the extension's extension.json file
$wgEnabledTranscodeSet = [
'160p.webm' => true,
'240p.webm' => true,
'360p.webm' => true,
'480p.webm' => true,
'720p.webm' => true,
'1080p.webm' => true,
];
$wgEnabledAudioTranscodeSet = [
'ogg' => true, // ogg+vorbis
'opus' => false, // ogg+opus
'mp3' => true, // raw mp3
'm4a' => false, // mp4+aac (mp4a.40.5)
];
// 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.
トランスコードジョブの実行
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
If running this command causes it to hang forever, you may need to set $wgTranscodeBackgroundTimeLimit = 0;
in LocalSettings.php.
タスク T206957 を参照してください。
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. You will need to install ffmpeg.
DebianおよびUbuntuでの最小限のインストール
apt install ffmpeg
Plus, add this to your LocalSettings.php (tested for Devuan ASCII (Archived 2018-09-23 at the Wayback Machine) only):
$wgFFmpegLocation = '/usr/bin/ffmpeg';
On older versions of MediaWiki (1.29–1.31)
- Version 1.31 was breaking for system administrators. この拡張機能はMwEmbedSupport への依存を解消し
wfLoadExtension
が必須となりました。そこで WebVideoTranscode PHP 定数は文字列値として表現されます。 - 注意点として MediaWiki 1.31 以降、MwEmbedSupport は TimedMediaHandler に同梱されていますが、それ以前の MediaWiki で使用する場合は改めて 過去ログページからダウンロードしてください。
In LocalSettings.php, load the extension with:
// MediaWiki 1.27 - 1.30
wfLoadExtension( 'MwEmbedSupport' );
require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";
// TimedMediaHandler はバージョン 1.30 以前は MwEmbedSupport に依存していました。
// MediaWiki 1.27 and earlier
require_once "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php";
require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";
Prior to 1.31, $wgEnabledTranscodeSet is set with:
// Before 1.31
$wgEnabledTranscodeSet = [
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 = [
WebVideoTranscode::ENC_OGG_VORBIS,
WebVideoTranscode::ENC_MP3,
];
Troubleshooting
- "ffmpeg – failed to map segment from shared object"
- You need to increase the allowed memory in $wgMaxShellMemory .
- "Class 'getID3' not found"
- You need to install the extension's PHP dependencies using Composer, see the Installation section above.
![]() | この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |
- Stable extensions/ja
- Media handling extensions/ja
- API extensions/ja
- GPL licensed extensions/ja
- Extensions in Wikimedia version control/ja
- ArticleContentOnDiff extensions/ja
- ArticleFromTitle extensions/ja
- ArticlePurge extensions/ja
- BeforePageDisplay extensions/ja
- CanonicalNamespaces extensions/ja
- FileDeleteComplete extensions/ja
- FileUpload extensions/ja
- GetBetaFeaturePreferences extensions/ja
- ImageOpenShowImageInlineBefore extensions/ja
- ImagePageAfterImageLinks extensions/ja
- ImagePageFileHistoryLine extensions/ja
- LoadExtensionSchemaUpdates extensions/ja
- MediaWikiPerformAction extensions/ja
- PageRenderingHash extensions/ja
- ParserTestGlobals extensions/ja
- ParserTestTables extensions/ja
- RejectParserCacheValue extensions/ja
- ResourceLoaderGetConfigVars extensions/ja
- RevisionFromEditComplete extensions/ja
- SkinTemplateNavigation::Universal extensions/ja
- TitleMove extensions/ja
- WgQueryPages extensions/ja
- All extensions/ja
- Extensions requiring Composer with git/ja
- Outdated pages/ja
- Extensions used on Wikimedia/ja
- Video player extensions/ja
- Audio player extensions/ja