# Extension talk:TimedMediaHandler

## Forcing use of Kaltura HTML5 Player instead of VideoJS

2

I'm struggling to get Kaltura HTML5 player working on a wiki, since it is consistently attempting to force VideoJS. This is undesirable for me, since my primary use of TimedMediaHandler is to handle OGG files, which work much better with Kaltura (it's not fullscreen!). Is it possible to force Kaltura HTML5, or otherwise just allow VideoJS to work without going fullscreen on audio files? ~~~~

Yes, add the line $wgTmhWebPlayer = "mwembed"; to your LocalSettings.php file. Note, however, that we're expecting to delete the legacy Kaltura player entirely quite soon. Reply to "Forcing use of Kaltura HTML5 Player instead of VideoJS" ## HOWTO LOOP video. +Opus 44.1k failure & Same-size re-encodes 4 1) Most importantly I would like TimedMediaHandler to have a "loop" video option for making short video clips (say it's just 15-20 seconds) loop automatically when they are played. 2) It would be nice to be able to set a video size of 100% instead of pixels and have it resize to whatever size the screen/browser is using. Should of course also work if the browser is resized after playbacks begun. 3) Unrelated, uploading a MP3 with 44.1k audio makes TimedMediaHandler specify 44.1k when converting to Opus which fails since it's a 48k format. That's a bug. 4) I also find it very annoying that if I upload a 1080p VP9/Opus webm TimedMediaHandler will convert the file to that same format in addition the other formats. A check to see if the file's already in the target format would be preferable and reduce server load. Hi, for 1) as a dirty hack, to get a button below the player to replay the video sequence, one may edit the extension as shown below. This solution is just a first approach an need to be further improved regarding stability, readability etc. but its a starting point. This adds an individual javascript function under each videoplayer tag in the document, using the specific id of the video tag. the javascript function is started by clicking the button and will restart and play the video sequence. edit the file [PathToYourMediawiki]/extensions/TimedMediaHandler/includes/TimesMediaTransformOutput.php search for function 'getHtmlMediaTagOutput(...' specifically search for the following code lines: // Build the video tag output:$s = Html::rawElement( $this->getTagName(),$this->getMediaAttr( $sizeOverride,$autoPlay ),

// The set of media sources:

self::htmlTagSet( 'source', $mediaSources ) . // Timed text: self::htmlTagSet( 'track',$mediaTracks )

);

$s .= '<script type="text/javascript">';$s .= 'function replayVideo'.self::$serial.'() {';$s .= "var el = document.getElementById('";

$s .= "mwe_player_";$s .= self::$serial-1;$s .= "'); ";

$s .= "el.muted = 'true'; el.load(); el.play(); }</script>";$s .= '<form><input type="button" onclick="replayVideo';

$s .= self::$serial.'()" value="(re)play"</form>';

Note: i'm sure this can be written in a nicer way, it's decades since i used php ;)

1) correct filename is TimedMediaTransformOutput.php (not TimesMedia...)

2) dont use the <form> and </form> tag from the source above, it will result in errors with input button afterwards (like formlink etc.)

3) el.muted = 'true' has no effect for most browsers and is not wanted for most users (mute video)

I would like to chime in on issue nr. 4. I use SimpleScreenRecorder to produce a VP8-720p video file. When uploaded, it is unnecessarily transcoded to another VP8-720p video file.

For instance, I have Video.webm of 51.3 MB with VP8-720p-15fps-398kbps and Vorbis-48kHz-112kbps. The transcoding produces Video.720p.webm with almost exactly the same specs, the only difference lying in the bitrate (581kbps) and thus an increased file size of 74.9 MB. This does not make sense as the video quality of the transcoded copy cannot get any better with an increased bitrate.

I think the extension should only mark the WEBM-video file for transcoding if any of the basic settings (frame size, fps, video/audio bit rate) of the original are (strictly) greater than the standard settings. Does that make sens? I am no expert at all with video encoding.

Reply to "HOWTO LOOP video. +Opus 44.1k failure & Same-size re-encodes"

## Notice: Undefined index

4

Hello,

we are getting the following PHP errors in the pages where TimedMediaHandler is used, and the entire content of the page becomes blank:

Notice: Undefined index: oga in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070
Notice: Undefined index: ogv in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070
Notice: Undefined index: vorbis in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070
Notice: Undefined index: oga in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070
Notice: Undefined index: ogv in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070
Notice: Undefined index: vorbis in /var/www/OUR WEBSITE/www/w/extensions/TimedMediaHandler/includes/WebVideoTranscode/WebVideoTranscode.php on line 1070

LocalSettings.php contains:

wfLoadExtension( 'TimedMediaHandler' );
$wgEnableTranscode = true;$wgFFmpegLocation = '/usr/bin/ffmpeg';
$wgEnabledAudioTranscodeSet = [ 'vorbis' => true, 'mp3' => true, 'ogg' => true, 'oga' => true, 'ogv' => true ]; Special:Version contains: MediaWiki 1.32.0 PHP 7.2.33-1+0~20200807.47+debian10~1.gbpcb3068 (fpm-fcgi) MariaDB 10.3.23-MariaDB-0+deb10u1 ICU 65.1 ... TimedMediaHandler 0.6.0 (13591c8) 01:23, 13 ott 2019 From the error log: https://pastebin.com/wLB2R3db We tried uninstalling and re-installing the extension, following every step. We tried TimedMediaHandler 0.5.0 and then 0.6.0 with no success. Ffmpeg is installed. Note that the extension was working until a few days ago, when we moved to a new server, any other extension is working like before. Any idea of what the problem might be? The only valid audio profiles are: ogg, opus, mp3 and m4a. I notice that the main documentation page is also wrong here. I'll update that. As I remember correctly, I experienced a similar issue before I set $wgMaxShellMemory = 907200; within LocalSettings.php.

## Fatal error: Call to undefined method ForeignDBRepo::fetchImageQuery

5

Dear Sir,

0) Background

I develop WP-MIRROR which is a utility for building a set of mirrors of WMF wikis. Home: <http://http://www.nongnu.org/wp-mirror/>. For WP-MIRROR 0.7, my objective is this: A wiki page rendered by the mirror site, should look the same as that page rendered by the WMF site. Version 0.6 fell short in this regard because: a) it depends upon the DEB package for MediaWiki 1.19 LTS which is not able to render many features that were introduced in 2013 (e.g. wikidata, scribunto, ...); and b) it depends upon several DEB packages for extensions compatible with 1.19 LTS which do not include many extensions currently used by WMF (e.g. math w/ mathjax, score, timeline, timedmediahandler, etc.)

In support of this objective, I am preparing a DEB package of MediaWiki 1.23alpha, and a DEB package of most of the extensions listed on <http://en.wikipedia.org/wiki/Special:Version>. So far I have packaged a couple dozen extensions with good results, but have hit a snag with TimedMediaHandler.

1) Mirror

1.1) WP-MIRROR builds a mirror of <http://simple.wikipedia.org/> out of the box using dump files from <http://ftpmirror.your.org>.

1.2) For MediaWiki, I am using the latest git pull' from the GIT repository <https://gerrit.wikimedia.org/r/p/mediawiki/core.git>. For MediaWiki extensions, I am using the latest git pull' from the GIT repositories under <https://gerrit.wikimedia.org/r/p/mediawiki/extensions/>. MwEmbedSupport and TimedMediaHandler are installed and configured as per the README.

1.3) As Debian dependencies, I have installed: cortado 0.6.0-1, ffmpeg 6:0.8.10-1, fmpeg2theora 0.27-2, imagemagick 8:6.7.7.10-5+deb7u2, libav-tools 6:0.8.10-1, libvpx1 1.1.0-1, oggvideotools 0.8a-1, php5-cli 5.4.4-14+deb7u7, php-getid3 1.9.3-1, php-pear 5.4.4-14+deb7u7.

1.4) LocalSettings.php' contains:

...
require_once( "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php" ); require_once( "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php" );
ini_set( 'include_path',
".:$IP:$IP/includes:$IP/languages:/usr/share/php" . PATH_SEPARATOR . ini_get( 'include_path' ) );$wgVideoPlayerSkin      = 'kskin';
$wgEnableTranscode = true;$wgEnableNiceBackgroundTranscodeJobs = true;
$wgFFmpeg2theoraLocation= '/usr/bin/ffmpeg2theora';$wgFFmpegLocation       = '/usr/bin/avconv';
$wgOggThumbLocation = '/usr/bin/oggThumb'; ...  2) Testing Most ordinary pages display properly: <http://simple.wikipedia.site/wiki/Apple>. 3) Errors Ordinary pages with OGV files render as blank. Two examples: 3.1) Use Firefox to view: <http://simple.wikipedia.site/wiki/Burnout> Error message in /var/log/apache2/wp-mirror.site-error.log': [Wed Feb 26 12:17:30 2014] [error] [client ::1] PHP Fatal error: Call to a member function doTransform() on a non-object in /usr/share/wp-mirror-mediawiki/extensions/TimedMediaHandler/TimedMediaThumbnail.php on line 201 3.2) Use Firefox to view: <http://simple.wikipedia.site/wiki/Sintel> Error message in /var/log/apache2/wp-mirror.site-error.log': [Wed Feb 26 11:04:41 2014] [error] [client ::1] PHP Fatal error: Call to undefined method ForeignDBRepo::fetchImageQuery() in /usr/share/wp-mirror-mediawiki/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscode.php on line 396 Under /tmp/', can be found many files like /tmp/transform-aaaabbbbcccc-1.jpg', where the string aaaabbbbcccc' is composed of hexadecimal characters. 4) Request Any advise would be appreciated. I am now reading the code but do not yet grasp where the problem is; hence this note. If this is not the right location to write such a note, please let me know if there is an appropriate mailing list. Sincerely Yours, Kent Hardware: x86x64, 6G DRAM OS: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux Distribution: Debian 7.4 (wheezy), with back-ports MediaWiki: most recent version (1.23alpha) obtained from GIT repository Extensions: most recent versions obtained from GIT repository Its a bug in TimedMediaHandler. TimedMediaHandler isn't compatible with ForeignDBRepo based image stores. Try using ForeignDBViaLBRepo instead (They're basically the same, One just uses a$wgLBFactoryConf instead).

Issue filed as bugzilla:61986

@Bawolff Could you explain better your solution? DonPaolo (talk) 20:36, 10 July 2020 (UTC)

Reply to "Fatal error: Call to undefined method ForeignDBRepo::fetchImageQuery"

## Support for other video formats (+ issue on transcoding failing on height/width detection)

2

I had a legacy bunch of hundreds of videos medias in different videoformats on my wiki, and needed all to get supported with few efforts, as long as to allow my users to continue to upload new ones. I just customized a bit TimedMediaHandler code and the magic happened.

If other people get the same interest, here the record of what I did :

1. I created the new handler "OtherVideoHandler.php" : it basically extends Mp4Handler and simply adjust a couple of methods relying on metadatas (frequently not well recognized). I declared this new handler into extension.json (and added messages "timedmedia-other-short-video" and "timedmedia-other-long-video" into i18n (english) file for displaying descriptions that do not mention 'mp4' :D ).
2. In includes/TimedMediaHandlerHooks.php , I added several mime types support, and modified an if-clauses accordingly :
70,88d69
< 		$wgMediaHandlers['video/flv'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/x-flv'] = 'OthervideoHandler';//PMU
< 		$wgMediaHandlers['application/x-shockwave-flash'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/mpeg'] = 'OthervideoHandler';//PMU
< 		$wgMediaHandlers['video/x-m4v'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/m4v'] = 'OthervideoHandler';//PMU
< 		$wgMediaHandlers['video/x-mp4'] = 'OthervideoHandler';//PMU alternate for m4v <$wgMediaHandlers['application/smil'] = 'OthervideoHandler';//PMU
< 		$wgMediaHandlers['video/3gpp'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/avi'] = 'OthervideoHandler';//PMU
< 		$wgMediaHandlers['video/x-ms-wmv'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/x-ms-asf'] = 'OthervideoHandler';//PMU alternate for wmv
< 		$wgMediaHandlers['video/x-msvideo'] = 'OthervideoHandler';//PMU <$wgMediaHandlers['video/quicktime'] = 'OthervideoHandler';//PMU mov
< 		$wgMediaHandlers['image/vnd.wap.wbmp'] = 'OthervideoHandler';//PMU alternate for mov <$wgMediaHandlers['application/x-font-gdos'] = 'OthervideoHandler';//PMU alternate for mov

292,293c273
< 		if ( ( $mediaType == 'webm' ||$mediaType == 'ogg' || $mediaType == 'mp4' ||$mediaType == 'othervideo' /*PMU*/)

3. Also, I noted that transcoding and thumbnailing failed on several videos, because the height/width couple was not well detected. I don't know if it only happens on my alternate videoformats or if it is a bug. Nevertheless I mention it here so if people encounter the same issue you can debug more easily : I added a "not null not zero" test in several places of TimedMediaThumbnail.php + WebVideoTranscode.php + WebVideoTranscodeJob.php . (Note : if a video still doesn't want to trigger transcodes at all, check out in mysql its record into the image table, you may have surprises on how it was described...)
4. And last but not least, I triggered transcodes : I re-ran the scripts "requeueTranscode --missing", "requeueTranscode --error", "runJobs --type webVideoTranscodePrioritized ", purged the related wiki-pages-cache with the general maintenance purgePage.php script.

Why don't you file a bug with Phabricator ad upload a patch? Just make the extra formats disabled by default, to calm paranoia.
Alex Mashin (talk) 04:51, 6 June 2020 (UTC)

Reply to "Support for other video formats (+ issue on transcoding failing on height/width detection)"

## $wgMinimumVideoPlayerSize doesn't work on MediaWiki 1.34 1 Hello, I just installed the extension on our (private) MediaWiki 1.34. We do not need transcode at the moment and want to use just the video player. The problem is that: there is not any popup window, no matter the value of $wgMinimumVideoPlayerSize.

When the video is smaller than the value of $wgMinimumVideoPlayerSize, when I click on the play button (located at the upper left corner), then appears an embedded player instead of popup window. Does this option is available for MW 1.34? And, id yes, how to achieve it? Here is the relevant part of the LocalSettings.php file: wfLoadExtension( 'TimedMediaHandler' );$wgFFmpegLocation = '/usr/bin/ffmpeg';
$wgMaxShellMemory = 907200;$wgEnableTranscode = false;
$wgMinimumVideoPlayerSize = 10;$wgEnabledTranscodeSet = [];

Reply to "$wgMinimumVideoPlayerSize doesn't work on MediaWiki 1.34" ## only one <source> in <video>, no derivative 2 Hi, I installed and configured Ti!edMediaHandler latest version on Mediawiki 1.34. Uploading a video works fine and does transcode several derivatives. However when inserting File:xxx.mp4 in a page, I only have the original video inserted in HTML, there is only one < source > tag inside the < video > tag. Thus I can't get any benefit of the derivatives. In my config, I do have wgEnableTranscode=true and I do have wgEnabledTranscodeSet with the derivatives configured (hence transcoding works :) ) . What could I possibly miss ? Or what could the plugin miss ? This often happens when there is no active jobrunner to quickly take care of purging the pages that the video is included on, after the transcodes finished. Reply to "only one <source> in <video>, no derivative" ## Empty thumbnails being generated 1 The extension correctly creates 640px thumbnails for videos, but all smaller thumbnails are empty zero byte files. What could possibly be the reason for this? Reply to "Empty thumbnails being generated" ## OGG file won't play in mobile devices, but works fine for desktop 2 I am creating a wiki for people to learn how to pronounce some difficult names in my language. I have recorded audio in OGG files and uploaded to the wiki, and they play fine in desktop browsers like Chrome and Microsoft Edge. Here is an example: https://chinesenamesinenglish.com/wiki/A However, in mobile devices (both Safari and Chrome in iphone X), if I use MobileFrontend (I tried different skins), the audio is not played after I click the play button but the player is displayed. If I use desktop view in mobile devices, the player is not even displayed. In contrast, Wikipedia's audio plays fine in mobile devices. For example, https://en.wikipedia.org/wiki/The_Star-Spangled_Banner Can anyone help? Thank you! I am using MediaWiki v1.33.1 and the extensions and skins are latest compatible versions. For now, I bypassed this issue by replacing OGG files with mp3 files. However, I still hope to know how to solve this problem. Your help will be greatly appreciated! Reply to "OGG file won't play in mobile devices, but works fine for desktop" ## Class 'getID3' not found trying to upload a video file 12 Hello, when trying to upload a video file (either webm or mp4) I get the following error: [10f9430f9e6bc3a83ac9f5ad] /wiki/Especial:SubirArchivo Error from line 15 of /home/krusher/www.apocrypha.ovh/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php: Class 'getID3' not found Backtrace: #0 /home/krusher/www.apocrypha.ovh/extensions/TimedMediaHandler/includes/handlers/Mp4Handler/Mp4Handler.php(12): ID3Handler->getID3(string) #1 /home/krusher/www.apocrypha.ovh/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): Mp4Handler->getID3(string) #2 /home/krusher/www.apocrypha.ovh/includes/utils/MWFileProps.php(84): ID3Handler->getMetadata(FSFile, string) #3 /home/krusher/www.apocrypha.ovh/includes/upload/UploadBase.php(506): MWFileProps->getPropsFromPath(string, string) #4 /home/krusher/www.apocrypha.ovh/includes/upload/UploadBase.php(441): UploadBase->verifyPartialFile() #5 /home/krusher/www.apocrypha.ovh/includes/upload/UploadBase.php(344): UploadBase->verifyFile() #6 /home/krusher/www.apocrypha.ovh/includes/upload/UploadFromFile.php(95): UploadBase->verifyUpload() #7 /home/krusher/www.apocrypha.ovh/includes/specials/SpecialUpload.php(506): UploadFromFile->verifyUpload() #8 /home/krusher/www.apocrypha.ovh/includes/specials/SpecialUpload.php(204): SpecialUpload->processUpload() #9 /home/krusher/www.apocrypha.ovh/includes/specialpage/SpecialPage.php(569): SpecialUpload->execute(NULL) #10 /home/krusher/www.apocrypha.ovh/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL) #11 /home/krusher/www.apocrypha.ovh/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext) #12 /home/krusher/www.apocrypha.ovh/includes/MediaWiki.php(865): MediaWiki->performRequest() #13 /home/krusher/www.apocrypha.ovh/includes/MediaWiki.php(515): MediaWiki->main() #14 /home/krusher/www.apocrypha.ovh/index.php(42): MediaWiki->run() #15 {main} Am I doing something wrong or do I lack something? Regards. Did you install from git ? Because it looks like the composer dependencies of the extension were not installed. Correct, after executing composer update it works. Thanks! Maybe it should be noted in the installation process. I just installed the extension via downloading and extracting the tar and not using git but I received the same error message, had to install composer and run composer update --no-dev to get rid of this. Not sure whether that is intended but at the moment this step should be noted as a general requirement for the installation process Is this the intended behaviour and is there a workaround? I have a MW instance on a shared server with no root access so I cannot install composer. You can install composer on your local computer, use it on a copy of the extension, and then upload the whole folder to the server i've update the documentation some more. Turns out the tarball versions of the extension also don't include the vendor directory (only the main tarball for core + common extensions does). Krusher, this is a somewhat simple error that I ran into also. Just do $ composer require james-heinrich/getid3

In a similar vein: with TimedMediaHandler REL1_33 installed (via the ExtensionDistributor download) I recently ran into an issue where the missing getID3 interfered with the operation of refreshImageMetadata, which in turn prevented PdfHandler from working properly. To follow up on TheDJ's point above, could someone describe what files specifically are missing from the download that are needed for the extension to operate correctly?

You need to run composer install --no-dev in the extension directory

Yeah, it's this huge note in the page:

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"
]
}
}
}

If you are on shared hosting, follow the following steps:

Goodman Andrew (talk) 14:33, 28 December 2019 (UTC)