Extension:TimedMediaHandler

This page is a translated version of the page Extension:TimedMediaHandler and the translation is 66% complete.
Other languages:
English • ‎dansk • ‎español • ‎français • ‎português do Brasil • ‎русский • ‎فارسی • ‎中文 • ‎日本語 • ‎한국어
Manuel des extensions MediaWiki
OOjs UI icon advanced.svg
TimedMediaHandler
État de la version : stable
Screenshot of TimedMediaHandler extension with Big Buck Bunny as background video.png
Implémentation Média, API
Description Fournit un support intégré pour le transcodage côté serveur, WebM, Ogg Theora, Vorbis, MP3, Speex et texte temporisé
Auteur(s) Michael Dale, Jan Gerber, Tim Starling, James Heinrich, Brion Vibber, Derk-Jan Hartman
Dernière version 0.6.0 (2018-11-07)
Politique de compatibilité branches de version
MediaWiki 1.29+
PHP 5.6+
Modifie la base de données Oui
Tables transcode
Licence Licence publique générale GNU v2.0 ou supérieur
Téléchargement
  • $wgMediaAudioTypes
  • $wgMediaVideoTypes
  • $wgWaitTimeForTranscodeReset
  • $wgEnableNiceBackgroundTranscodeJobs
  • $wgTmhEnableMp4Uploads
  • $wgUseFFmpeg2
  • $wgEnableTranscode
  • $wgTmhSoundfontLocation
  • $wgTmhWebPlayer
  • $wgTmhPriorityResolutionThreshold
  • $wgFFmpegVP9RowMT
  • $wgEnableIframeEmbed
  • $wgOggThumbLocation
  • $wgParserTestMediaHandlers
  • $wgTranscodeBackgroundSizeLimit
  • $wgTranscodeBackgroundTimeLimit
  • $wgTmhFluidsynthLocation
  • $wgTimedTextForeignNamespaces
  • $wgEnabledAudioTranscodeSet
  • $wgTmhFileExtensions
  • $wgEnabledTranscodeSet
  • $wgTmhUseBetaFeatures
  • $wgMinimumVideoPlayerSize
  • $wgFFmpegThreads
  • $wgMwEmbedModuleConfig
  • $wgTranscodeBackgroundMemoryLimit
  • $wgEnableLocalTimedText
  • $wgFFmpegLocation
  • $wgTmhPriorityLengthThreshold
  • $wgTimedTextNS
  • $wgTranscodeBackgroundPriority
  • transcode-reset
  • transcode-status
Traduisez l’extension TimedMediaHandler sur translatewiki.net
Vérifiez la matrice des utilisations et des versions.
Problèmes Tâches ouvertes · Signalez un bogue

L'extension TimedMediaHandler vous permet d'inclure des fichiers audio et vidéo dans les pages wiki, en utilisant la même syntaxe que pour les fichiers d'images . Elle comprend le lecteur HTML5 Kaltura ainsi que le lecteur VideoJS expérimental. 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. La prise en charge côté serveur TMH comprend les options permettant de télécharger de l'audio et de la vidéo HTML5, plusieurs profils de transcodage pour délivrer le contenu, la lecture des fichiers MIDI, l'analyse des métadonnées pour les vidéos Ogg et WebM, et l'intégration au système de file d'attente des travaux de MediaWiki pour l'ordonnancement des tâches de transcodage.

Aperçu de la fonctionnalité

Voir la page Commons:Commons:Timed Text .

Aperçu de la syntaxe

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: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]]
Affiche une vidéo dans une boîte de vignette flottante
<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. Vous pouvez aussi utiliser HH:MM:SS ; par exemple 1:02:22 représente 1 heure, 2 minutes, et 22 secondes dans la vidéo.
[[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. Vous pouvez aussi utiliser HH:MM:SS ; par exemple 1:02:22 représente 1 heure, 2 minutes, et 22 secondes dans la vidéo.
Obsolète
Les mots noicon et noplayer de la syntaxesont obsolètes et ne fonctionnent pas. The keyword disablecontrols will likely be deprecated. (voir tâche 135537) It takes a comma-separated list of any of the following values: options, timedText, fullscreen

Support client

Exemple de lecteur vidéo
Exemple de lecteur audio
Lecteur audio plus large, affichant la barre de progression

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.

Installation

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/. Voir la section ci-dessous pour les instructions d'installation sur les versions plus anciennes de MediaWiki.

  • Téléchargez et placez le(s) fichiers (s) dans un répertoire appelé TimedMediaHandler dans votre dossier extensions/.
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php :
    // MediaWiki 1.31 and later
    wfLoadExtension( 'TimedMediaHandler' );
    $wgFFmpegLocation = '/usr/bin/ffmpeg'; // Most common ffmpeg path on Linux
    
  • Exécutez le script de mise à jour qui va créer automatiquement les tables de base de données dont cette extension a besoin.
  • This extension requires Composer to install PHP dependencies. Go to the extension directory and run composer install --no-dev.
  • Configure as required.
  • You may need to increase the allowed memory in $wgMaxShellMemory .
  •   Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

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

Après avoir téléchargé cette extension, veuillez noter qu'elle nécessite 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"
			]
		}
	}
}

Comparaison entre les différentes options d'encodage des médias Wikipedia

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):

Débit 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

Options détaillées :

Nom 160P 240P 360P 480P 720P 1080P 160P 240P 360P 480P 720P 1080P 1440P 2160P
Conteneur WebM
Vidéo Encodage VP8 VP9
Largeur maximale (pixels) 288 426 640 854 1280 1920 288 426 640 854 1280 1920 2560 4096
Hauteur maximale (pixels) 160 240 360 480 720 1080 160 240 360 480 720 1080 1440 2160
Débit (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 Encodage Vorbis Opus
Canaux 2 (stereo) (pass-through)
Taux d'échantillonnage (Hz) 44100 48000
Qualité - 1 2 3 - (default)

Configuration

Cette section est obsolète -- à mettre à jour svp

Voici quelques paramètres de configuration pouvant être utiles :

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

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

Exécuter les tâches de transcodage

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. Voir tâche T206957.

Noeuds d'encodage

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.

Installation minimale sous Debian et Ubuntu

apt install ffmpeg

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

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

On older versions of MediaWiki (1.29–1.31)

  • La version 1.31 apporte une rupture pour les administrateurs système. The extension now requires wfLoadExtension, dropped the dependency for the MwEmbedSupport extension, and the WebVideoTranscode PHP constants are now expressed as string values instead.
  • 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.

In LocalSettings.php, load the extension with:

// MediaWiki 1.27 - 1.30
wfLoadExtension( 'MwEmbedSupport' );
require_once "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php";

// TimedMediaHandler dépendait de MwEmbedSupport jusqu'à la version 1.30
// 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

Cette section doit être développée
"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.