Extension talk:TimedMediaHandler

About this board

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

1
Pio~frwiki (talkcontribs)

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.


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

$wgMinimumVideoPlayerSize doesn't work on MediaWiki 1.34

1
Spas.Z.Spasov (talkcontribs)

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
Pio~frwiki (talkcontribs)

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 ?

TheDJ (talkcontribs)

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
Þjarkur (talkcontribs)

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
Boxiao (talkcontribs)

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.

Boxiao (talkcontribs)

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
Krusher (talkcontribs)

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.

TheDJ (talkcontribs)

Did you install from git ? Because it looks like the composer dependencies of the extension were not installed.

Krusher (talkcontribs)

Correct, after executing composer update it works. Thanks! Maybe it should be noted in the installation process.

Bowdzone (talkcontribs)

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

Madewild (talkcontribs)

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.

Ciencia Al Poder (talkcontribs)

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

TheDJ (talkcontribs)

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

Bttfvgo (talkcontribs)

Krusher, this is a somewhat simple error that I ran into also. Just do

$ composer require james-heinrich/getid3

from your Mediawiki root directory. Glad you got it working!

Huwmanbeing (talkcontribs)

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?

Ciencia Al Poder (talkcontribs)

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

TheDJ (talkcontribs)

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


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"
			]
		}
	}
}
Goodman Andrew (talkcontribs)

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

1. Download James-heinrich/getid3 from [php-download.com/package/james-heinrich/getid3]

2. Go to your file manager and on the extension/TimedMediaHandler folder, upload James-...

3. Extract James

4. Go back to your wiki and run the upload again.

Goodman Andrew (talk) 14:33, 28 December 2019 (UTC)
Reply to "Class 'getID3' not found trying to upload a video file"

Transcode key [resolution].ogv not found, skipping

2
Scarred Sun (talkcontribs)

I'm running into an issue where upon running webVideoTranscode jobs, I wind up getting skipping and errors over any OGV files (and potentially OGG/MP3 files, though it's hard to tell with video backlogs). For what it's worth, I have all the requisite codecs (libtheora, lame, etc.) on the server. Any idea why this may be happening?

Brion VIBBER (talkcontribs)

I believe this message will come up when there's a job to run a transcode, but there's no entry in the data loaded from the transcode table that matches that id. One possibility is that the configured transcode settings are messed up... we did an incompatible config change last year or so which might be tripping up some configs that recently updated. If you're manually altering or setting $wgEnabledTranscodeSet make sure you're using the current format -- instead of a list of constants, it's an associative array of the actual string keys to a boolean which indicates whether they're on or off. If the config is damaged, it might be causing some trouble there.

If that doesn't seem to be the problem, we may need to check logs or double-check that the database table is ok. (And confirm what version you're running etc before we try debugging!)


Reply to "Transcode key [resolution].ogv not found, skipping"

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

3
2001:2002:51ED:CEE0:DC5D:AE01:E6DE:3306 (talkcontribs)

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.

78.54.53.70 (talkcontribs)

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 )

);


add the following lines below:

$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 ;)

77.11.15.116 (talkcontribs)

some additional notes:

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)


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

Not Working - uploaded files not found

3
194.154.200.228 (talkcontribs)

Once I activate TimedMediaHandler (and MwEmbedSupport), "[[File:XXXX]]" links simply change to red as if the file wouldn't exist (previously they were ok).

Files have been uploaded correctly.

Tested on a vanilla MW 1.27.3 (LTS) with TMH 1.27 and 1.28.

194.154.200.228 (talkcontribs)

Same with MW 1.29.0

Ivan Mudrik (talkcontribs)

Same with MW 1.33

Reply to "Not Working - uploaded files not found"

extension.json not included in download file

4
118.148.171.25 (talkcontribs)

Does anyone know if this will stream a video when importing a page from wikipedia or will it download the video to my server first?

Also I am getting this error PHP Fatal error:  Uncaught Exception: xxxx/TimedMediaHandler/extension.json does not exist! in xxxx/includes/registration/ExtensionRegistry.php:117

I have checked the paths and it does not seem to be in the download file. I assume that we could add this file in there from github /wikimedia/mediawiki-extensions-TimedMediaHandler/blob/master/extension.json?

TheDJ (talkcontribs)

This extension supports local files and files hosted on 'foreign repos', like Wikimedia Commons via InstantCommons. It does not handle anything like Youtube etc.

TheDJ (talkcontribs)

Your error likely means you are using an old version/download of the extension, in combination with the newer wfLoadExtension method of loading the extension. wfLoadExtension depends on extension.json being present. If extension.json is not present you have an old version of it.

I always advise to download the branch version (REL_***) of an extension that matches the version of MediaWiki core that you are running.

Tacsipacsi (talkcontribs)

It depends. If you import the file while importing the page, it will be on your server. If you don’t import the file, it has to be on Wikimedia Commons and you need to have InstantCommons to be able to use the file directly from Commons (otherwise the file will be marked as missing, i.e. a red link will appear instead of the file). This applies to all kinds of files, with videos being no exception. If a video is displayed from Commons, it’s played from Commons entirely (you can confirm this by playing a video on MediaWiki.org, and check your browser console to see it’s played from https://upload.wikimedia.org/wikipedia/commons/*).

Where did you download the extension from? I checked the four versions available at Special:ExtensionDistributor/TimedMediaHandler, and all of them had extension.json.

(N.B. I started writing this answer before the above ones arrived, and this *** haven’t warned me of them.)

Reply to "extension.json not included in download file"
Return to "TimedMediaHandler" page.