Extension talk:TimedMediaHandler

About this board

Forcing use of Kaltura HTML5 Player instead of VideoJS

3
KevTYD (talkcontribs)

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? ~~~~

Jdforrester (WMF) (talkcontribs)

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.

Uvas magicas (talkcontribs)

exist the probably of use fullscreen in the files of video with the player kaltura html?

Reply to "Forcing use of Kaltura HTML5 Player instead of VideoJS"

Use a different content model?

3
Elli (talkcontribs)

I've noticed that pages in the TimedText namespace actually use the Wikitext content model. This is far from ideal and causes confusion and some problems with editing.


The extension should probably extend the "plain text" model instead. This would probably be a decently-hard change to make... but I think it should be considered.

Ciencia Al Poder (talkcontribs)

The intention is to get rid of the namespace altogether. See phab:T135221. I don't know when this goal will be achieved, though. May be worth a bugreport, since this can be done by config on WMF wikis.

Elli (talkcontribs)

Oh, interesting.


That is probably a good idea, because of how painful this namespace is to work with.

Reply to "Use a different content model?"

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

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


Sm8ps (talkcontribs)

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.

TheDJ (talkcontribs)

So the problem is that there can be a LOT of settings and knowing which combination works in all browsers is actually pretty hard. This is why it will always transcode, to ensure that it has a known usable version to present to browsers. (FYI: Youtube does this as well, you never see your original again after uploading it there).

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

Dear all,

My wiki when install TimedMediaHandler but webm file not working, please help me. Link: https://wikigiaitri.com/wiki/T%E1%BA%ADp_tin:H%C6%B0%E1%BB%9Bng_d%E1%BA%ABn_t%E1%BA%A1o_v%C3%A0_s%E1%BB%ADa_b%C3%A0i_tr%C3%AAn_Wiki_Gi%E1%BA%A3i_Tr%C3%AD.webm

My LocalSetting.php: wfLoadExtension( 'TimedMediaHandler' ); $wgFFmpegLocation = '/usr/bin/ffmpeg'; $wgMaxShellMemory = 907200; $wgEnableTranscode = false; $wgMinimumVideoPlayerSize = 10; $wgEnabledTranscodeSet = []; $wgTmhWebPlayer = "mwembed";

Reply to "Webm file not working"
41.254.66.25 (talkcontribs)

Is it possible to open images with this extension?

Tacsipacsi (talkcontribs)
Reply to "Open photos"
StormKyleis (talkcontribs)

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?

TheDJ (talkcontribs)

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.

TheDJ (talkcontribs)
Spas.Z.Spasov (talkcontribs)

As I remember correctly, I experienced a similar issue before I set $wgMaxShellMemory = 907200; within LocalSettings.php.

Reply to "Notice: Undefined index"

Fatal error: Call to undefined method ForeignDBRepo::fetchImageQuery

5
Wp mirror (talkcontribs)

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

Special pages all work: <http://simple.wikipedia.site/wiki/Special:Version>, <http://simple.wikipedia.site/wiki/Special:TimedMediaHandler>, <http://simple.wikipedia.site/wiki/Special:FileList>.

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

Bawolff (talkcontribs)

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

Wp mirror (talkcontribs)
DonPaolo (talkcontribs)

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

Bawolff (talkcontribs)
Reply to "Fatal error: Call to undefined method ForeignDBRepo::fetchImageQuery"

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

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


Alex Mashin (talkcontribs)

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
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"
Return to "TimedMediaHandler" page.