Kiterjesztés:TimedMediaHandler
TimedMediaHandler Kiadási állapot: stabil |
|
---|---|
Megvalósítás | Média, API |
Leírás | Provides integrated support for server-side transcoding, WebM, Ogg Theora, Vorbis, MP3, Speex, and Timed Text |
Szerző(k) | Michael Dale, Jan Gerber, Tim Starling, James Heinrich, Brooke Vibber, Derk-Jan Hartman |
Legfrissebb verzió | 0.6.0 |
Kompatibilitási irányelv | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | >= 1.43 |
Adatbázis-változtatások | Igen |
Táblák | transcode |
Licenc | GNU General Public License 2.0 or later |
Letöltés | |
|
|
|
|
|
|
Quarterly downloads | 193 (Ranked 30th) |
Public wikis using | 1,290 (Ranked 218th) |
Fordítsd le a(z) TimedMediaHandler kiterjesztést, ha elérhető a translatewiki.net oldalon | |
Problémák | Nyitott feladatok · Hibajelentés |
The TimedMediaHandler extension allows you to display audio and video files in wiki pages, using the same syntax as for image files. Ez tartalmazza a VideoJS-lejátszót. A feliratok (azaz az időzített szöveg), a valós idejű csatornaváltás több WebM- és más származékos mű közt, és számos más funkció támogatottak. TMH server-side support includes options for uploading HTML5 audio and video, multiple transcode profiles to deliver content, playback of MIDI files, metadata parsing for Ogg and WebM videos, and integration with MediaWiki's job queue system for scheduling transcoding jobs.
For new and upcoming developments in 2022 and beyond, see Extension:TimedMediaHandler/2022 work.
Feature overview
A lejátszóhoz lásd: VideoJS-lejátszó.
For features of the subtitling system, see Commons:Timed Text page.
Szintaxis
In addition to the image embed syntax, Timed Media Handler supports:
- [[File:Video.ogv]]
- Display a video at its nominal size. Displays a still image from the midpoint with a play button to start a pop-up video player.
- [[File:Audio.oga]]
- Show a placeholder for a sound file with a play button. The player will appear inline or as a pop-up if the audio file has closed captioning/subtitles.
- [[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. Használható ezenkívül a HH:MM:SS formátum, pl. az 1:02:22 jelentése: a 1 óra 2 perc 22 másodperc a videó kezdetétől. Floating-point seconds are supported (but broken on Wikimedia wikis: phab:T228467).
- [[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. Ezenkívül beírható a vég ideje
end=1:30
formátumban, ami 5 másodperces klipet jelent 1:25-től 1:30-ig. 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.- [[File:Video.ogg|muted]]
- Start the media with muted audio. (bevezetve: 1.39)
- [[File:Video.ogg|loop]]
- Loop the video continuously. (bevezetve: 1.39)
- Elavult
- A noicon és noplayer szavak elavultak, és nem működnek. A disablecontrols kulcsszó valószínűleg elavul. (Lásd: task T135537) It takes a comma-separated list of any of the following values: options, timedText, fullscreen
Client support
[[File:Videoonwikipedia.ogv|300px|thumb|...]]
[[File:example.ogg|thumb|...]]
[[File:example.ogg|30px]]
[[File:example.ogg]]
The player works on most modern browsers (see MediaWiki's support matrix). A mobiltámogatás változatos, különösképp iOS-en.
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.
Telepítés
You will want a recent version of ffmpeg in order to support encoding to WebM (with the latest version of VP9).
- Töltsd le a kiterjesztés fájljait, és mentsd el az
extensions/
mappán belüliTimedMediaHandler
könyvtárba.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TimedMediaHandler - Csak Gitről telepítés esetén futtasd a Composert a PHP-függőségek telepítéséhez a
composer install --no-dev
parancs kiadásával a kiterjesztés könyvtárában. (Lásd a task T173141 lapot a lehetséges problémákért.) - Add hozzá az alábbi kódot a LocalSettings.php fájlod aljára:
wfLoadExtension( 'TimedMediaHandler' ); $wgFFmpegLocation = '/usr/bin/ffmpeg'; // Most common ffmpeg path on Linux
- Futtasd le a frissítőszkriptet, ami automatikusan létrehozza a kiterjesztés által igényelt táblákat az adatbázisban.
- Állítsd be a szükséges módon.
- You may need to increase the allowed memory in $wgMaxShellMemory .
- Kész – A Special:Version oldalon ellenőrizheted, hogy a kiterjesztés ténylegesen feltelepült-e.
The extension will automatically add supported file types (except for mp4) to $wgFileExtensions , so you do not need to add video file types manually.
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 e.g.
{
"extra": {
"merge-plugin": {
"include": [
"extensions/TimedMediaHandler/composer.json"
]
}
}
}
Comparison of Wikipedia media encoding options
2018-ban a Wikimédia-oldalak VP9-et használtak.
Sorted by bandwidth tier:
Bitráta | Mbit/s | WebM VP8 | WebM VP9 |
---|---|---|---|
Szuperalacsony | 0.08 | 160p | |
Nagyon alacsony | 0.16 | 160p | 240p |
Alacsony | 0.25 | 240p | 360p |
Mérsékelt | 0.5 | 360p | 480p |
Közepes | 1.0 | 480p | 720p |
Magas | 2.0 | 720p | 1080p |
Nagyon magas | 4.0 | 1080p | 1440p |
Szupermagas | 8.0 | 2160p |
Részletes beállítások:
Név | 160P | 240P | 360P | 480P | 720P | 1080P | 160P | 240P | 360P | 480P | 720P | 1080P | 1440P | 2160P | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Konténer | WebM | ||||||||||||||
Videó | Kódolás | VP8 | VP9 | ||||||||||||
Maximális szélesség (pixel) | 288 | 426 | 640 | 854 | 1280 | 1920 | 288 | 426 | 640 | 854 | 1280 | 1920 | 2560 | 4096 | |
Maximális magasság (pixel) | 160 | 240 | 360 | 480 | 720 | 1080 | 160 | 240 | 360 | 480 | 720 | 1080 | 1440 | 2160 | |
Bitráta (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 | |
Hang | Kódolás | Vorbis | Opus | ||||||||||||
Csatornák | 2 (stereo) | (pass-through) | |||||||||||||
Mintavételi ráta (Hz) | 44100 | 48000 | |||||||||||||
Minőség | - | 1 | 2 | 3 | - | (default) |
Beállítás
Ez a lap elavult. |
Here are some configuration variables that may be useful:
// The minimum size for an embedded 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;
// Exclude transcoding jobs from the default job runner because they take very long to complete
$wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscode';
$wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscodePrioritized';
// The total amount 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 = [ 'commonswiki' => 102 ];
$wgTimedTextForeignNamespaces = [];
/**
* 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 a 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;
// If you use ffmpeg 2, it can be set to true
$wgUseFFmpeg2 = 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 should not run as part of the normal job queue (see task T29336).
Configure Localsettings.php
with:
$wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscode';
$wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscodePrioritized';
Setup dedicated jobrunners and request running the jobs by the --type
argument:
php ./maintenance/run.php runJobs --type webVideoTranscode
php ./maintenance/run.php runJobs --type webVideoTranscodePrioritized
It is very important to run these tasks as the webserver user.
A single transcode job for a video can easily take an hour or longer, so ensure the commands have enough time and CPU to run.
Encoding nodes
To transcode many videos, you might want to run multiple encoding nodes that connect to the master database 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 (Archived 2018-09-23 at the Wayback Machine) only):
$wgFFmpegLocation = '/usr/bin/ffmpeg';
Troubleshooting
Please note that versions of TimedMediaHandler before MediaWiki 1.38 did not work with PostgreSQL. Lásd: task T157424.
ffmpeg
– failed to map segment from shared object- You need to increase the allowed memory in $wgMaxShellMemory .
- A 'getID3' osztály nem található
- You need to install the extension's PHP dependencies using Composer; see the installation section.
- Unrecognized option 'max_muxing_queue_size'
- You may be using ffmpeg 2. You need add
$wgUseFFmpeg2 = true;
to yourLocalSettings.php
. - Unrecognized option 'max_muxing_queue_size'
- You may be using ffmpeg 2. You need add
$wgUseFFmpeg2 = true;
to yourLocalSettings.php
. - [exception] […] /index.php?title=Special:Upload Error: Call to undefined method FSFile::getLocalRefPath()
- This extension is incompatible with Extension:EmbedVideo . Távolítsd el. You may also need to make sure you did the composer steps properly.
See also
Ezt a kiterjesztést egy vagy több Wikimédia-projekt használja. Ez valószínűleg azt jelenti, hogy stabil és nagy biztonsággal használható ilyen forgalmas oldalakon is. A kiterjesztést használó wikik pontos listáját a Wikimédia CommonSettings.php és InitialiseSettings.php konfigurációs fájljaiban a nevére keresve találhatod meg. Egy adott wikin telepített összes kiterjesztés listája a wiki Special:Version oldalán található. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |