Open main menu

확장:타임미디어핸들러

This page is a translated version of the page Extension:TimedMediaHandler and the translation is 14% complete.
Outdated translations are marked like this.
Other languages:
English • ‎dansk • ‎español • ‎polski • ‎português do Brasil • ‎русский • ‎فارسی • ‎中文 • ‎日本語 • ‎한국어
미디어위키 확장 기능 매뉴얼
OOjs UI icon advanced.svg
TimedMediaHandler
출시 상태: 안정
Screenshot of TimedMediaHandler extension with Big Buck Bunny as background video.png
구현 미디어, API
설명 서버 측 트랜즈코딩, WebM, Ogg Theora, Vorbis, MP3, Speex 및 타임 텍스트에 대한 통합 지원을 제공합니다
만든이 Michael Dale, Jan Gerber, Tim Starling, James Heinrich, Brion Vibber, Derk-Jan Hartman
최신 버전 0.6.0 (2018-11-07)
호환성 정책 출시 브랜치
MediaWiki 1.29+
PHP 5.6+
데이터베이스 변경
라이선스 GNU General Public License 2.0 or later
다운로드
  • transcode-reset
  • transcode-status
TimedMediaHandler 확장 기능 번역 (translatewiki.net에서 가능한 경우)
사용법과 버전 매트릭스를 확인합니다.
이슈 미해결 작업 · 버그 보고
Version 1.31 was breaking for system administrators. The extension now requires wfLoadExtension, dropped the dependency for the MwEmbedSupport extension, and the WebVideoTranscode PHP constants are now expressed as string values instead.

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.

기본 개요

위키공용:위키공용:타임텍스트 문서를 참조하기 바랍니다.

구문 개요

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]]
Show a placeholder for a sound file, with a play button to start an embedded player.
[[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.
Deprecated
The syntax words noicon and noplayer are deprecated and do not function. The keyword disablecontrols will likely be deprecated soon. It takes a comma-separated list of any of the following values: options, timedText, fullscreen

고객 지원

Example video player
Example audio player
Wider audio player, showing progress bar

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.

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.

설치

Also see the README for detailed install instructions. Note that, although MwEmbedSupport was included in TimedMediaHandler for MediaWiki 1.31 and later, for MediaWiki versions prior to that you will need to download it from the archive page.

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


  • 파일을 다운로드해서, extensions/ 폴더 내의 TimedMediaHandler 이라는 이름의 디렉터리 내에 설치합니다.
  • PHP 의존 기능을 설치하려면 Composer를 실행하여 확장 기능 디렉터리에 composer install --no-dev를 발행하십시오. (잠재적인 문제에 대해서는 T173141 을 참고하십시오.)
  • 아래의 코드를 LocalSettings.php의 말미에 추가합니다:
    // MediaWiki 1.31 and later
    wfLoadExtension( 'TimedMediaHandler' );
    
    // MediaWiki 1.27 to MediaWiki 1.30
    wfLoadExtension( 'MwEmbedSupport' );
    require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";
    
    // TimedMediaHandler depended on MwEmbedSupport until 1.30
    // MediaWiki 1.27 and earlier
    require_once "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php";
    require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";
    
  • 갱신 스크립트를 실행합니다. 이 스크립트는 이 확장기능을 필요로 하는 데이터 베이스 테이블을 자동적으로 작성합니다.
  • Configure as required.
  •   완료 – 위키의 ‘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"
			]
		}
	}
}

Comparison of Wikipedia media encoding options

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

Detailed options:

이름 160P 240P 360P 480P 720P 1080P 160P 240P 360P 480P 720P 1080P 1440P 2160P
Container WebM
비디오 인코딩 VP8 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
Bitrate (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
Audio Encoding Vorbis Opus
Channels 2 (stereo) (pass-through)
Sampling rate (Hz) 44100 48000
Quality - 1 2 3 - (default)

Configuration

This section is out of date -- please update me

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
*/
// 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 = [
    'vorbis' => true,
    'mp3' => true,
];

// 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,
];

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

If running this command causes it to hang forever, you may need to set $wgTranscodeBackgroundTimeLimit = 0; in LocalSettings.php. See 작업 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.

Minimal install under Debian and Ubuntu

apt install ffmpeg

Plus, add this to your LocalSettings.php (tested for Devuan ASCII only):

$wgFFmpegLocation = '/usr/bin/ffmpeg';