Enhancing Multimedia Support in MediaWiki with the TimedMediaHandler Extension

Why MediaWiki Needs a Media Boost

Ever opened a wiki page and stared at a dead‑weight .mp4 link that just refused to play? You’re not alone. For years the core MediaWiki software treated audio and video like any other file – a downloadable blob, not a streaming experience. The result? Readers click, wait, and often bail. The TimedMediaHandler (TMH) extension flips that script, turning static links into embedded players that behave more like YouTube than a dusty FTP folder.

What TimedMediaHandler Actually Does

At its heart TMH is a bridge between MediaWiki’s file handling and modern HTML5 media. It does three things that matter most:

  • Inline playback – video and audio appear right inside the article, no extra tab required.
  • Transcoding pipelines – uploaded files are automatically converted into web‑friendly formats (WebM, Ogg, MP4) based on the server’s ffmpeg setup.
  • Rich metadata support – captions, subtitles, chapters, even 360° video angles are recognized and exposed to the player.

All of that runs on top of VideoJS, a battle‑tested JavaScript library. The wiki ends up with a player that looks familiar, works on mobile, and can be themed to match the site’s skin.

Quick glimpse – how a file looks after TMH is installed

Insert a video the same way you would an image:

[[File:ExampleVideo.webm|thumb|640px|An illustration of the new player]]

That single line now produces a fully‑functional player with play/pause, volume, and optional subtitles – no extra markup needed.

Getting TMH Up and Running

First things first: you need a MediaWiki version that supports the extension. The official page says “requires MediaWiki 1.35 or later,” so if you’re still on 1.30, it might be time for an upgrade. Below is a no‑frills checklist that most sysadmins will recognize.

  1. Download the extension via Composer or git.
  2. Drop it into extensions/TimedMediaHandler.
  3. Add a few lines to LocalSettings.php.
  4. Make sure ffmpeg and youtube-dl (optional) are in your $PATH.
  5. Run the update script: php maintenance/update.php.

Sample LocalSettings.php snippet

// Enable TimedMediaHandler
wfLoadExtension( 'TimedMediaHandler' );

// Optional: set a custom transcode profile directory
$wgFFMpegLocation = '/usr/bin/ffmpeg';
$wgTranscodeProfile = [ 'default' => [ 'formats' => [ 'webm', 'mp4' ] ] ];

// Enable subtitles (SDH = "subtitles for the deaf and hard‑of‑hearing")
$wgTimedMediaHandlerEnableSubtitles = true;

That’s it – in most cases the extension will start serving media the next time you clear the cache. If you hit a “missing ffmpeg” error, double‑check the binary path and make sure the web server can execute it.

New Features (2022‑2024) Worth Noticing

TMH isn’t a static add‑on; the developers keep tossing in goodies. A few highlights that have made a real difference in production wikis:

  • SDH subtitles – the extension now distinguishes “standard” captions from “SDH” ones, making it easier for accessibility‑focused sites to comply with WCAG.
  • 360° video support – you can embed immersive content, and the player automatically adds a “spin” control.
  • Share widget – a tiny button that lets users copy a direct link or embed code, reducing the “Where’s the share button?” complaints.
  • Iframe embedding – you can now place external videos (think Vimeo) side‑by‑side with native uploads without extra plugins.

One thing that often slips through the cracks is the new “metadata panel” that appears under the player. It surfaces technical details – bitrate, frame rate, even a tiny waveform for audio – which can be handy for editors who want to verify the source quality without leaving the wiki.

Best‑Practice Tips (From the Trenches)

Below are a few nuggets that have saved me a lot of head‑scratching over the years.

  • Don’t over‑transcode. If your source is already an MP4 with H.264, let it pass through unchanged. Unnecessary re‑encoding wastes CPU cycles and can degrade quality.
  • Use the “no‑thumb” option sparingly. The player’s default thumbnail is generated from the first keyframe – that’s usually fine, but for long documentaries you might want a custom poster image. Add |thumb|no‑thumb to suppress the auto‑thumb.
  • Watch out for MIME‑type mismatches. Some older browsers still choke on video/webm if the server sends application/octet-stream. A quick .htaccess tweak fixes it.
  • Enable caching for transcode jobs. The extension already stores generated files in cache/, but clearing that folder too often forces a full re‑transcode on every page view – a classic performance pitfall.

Example of a custom thumbnail

[[File:MyLecture.mp4|thumb|300px|link=|alt=Lecture thumbnail|frame=10]]

Here we ask the parser to grab frame 10 as the preview. Handy when the opening frame is just a black screen.

Real‑World Use Cases

It’s one thing to read about features; it’s another to see them in action. Below are three scenarios where TMH made a noticeable impact.

1. Academic Wikis – Lecture Capture

Universities that host open‑courseware often struggled with bandwidth spikes during exam season. By letting TMH serve lower‑resolution WebM streams to mobile devices while preserving the original HD MP4 for desktop, they cut peak traffic by roughly 30 %.

2. Cultural Heritage Projects

Digitising oral histories? The new SDH subtitle support lets archivists embed transcripts that are automatically synced. Visitors can toggle the captions on or off, keeping the page tidy for those who don’t need them.

3. Newsrooms & Community Blogs

When a breaking‑news video is uploaded, the “share widget” gives journalists a quick embed snippet they can copy into press releases. No need to hunt for a separate video platform; the wiki becomes the hub.

Potential Pitfalls and How to Dodge Them

Even the slickest extensions have rough edges. Here are a couple of gotchas that have tripped me up, plus quick fixes.

  • Transcode timeout. Large 4K files can take longer than the default max_execution_time. Raise the limit in php.ini or switch to asynchronous transcoding using the JobQueue extension.
  • Browser compatibility. Safari still has spotty support for WebM. The safest bet is to keep an MP4 fallback in the profile list.
  • Subtitles not showing. Verify that the subtitle file is named File:Video.en.srt (or .vtt) and placed in the same namespace as the video.

Future Outlook – Where TMH Might Go

Looking ahead, the community is already discussing a few ambitious ideas:

  1. Live streaming support. Think of a wiki that can broadcast a conference in real time, with the same player UI.
  2. AI‑generated captions. Integration with speech‑to‑text services could auto‑populate subtitle tracks on upload.
  3. Enhanced analytics. A dashboard that tells you how many times a video was played, average watch time, and drop‑off points.

None of those are in the core yet, but the roadmap shows the developers are listening to the community’s “what‑if” questions.

Wrapping Up (Without a Formal “Conclusion”)

If you’ve ever felt that MediaWiki’s media handling was stuck in the stone‑age, the TimedMediaHandler extension offers a surprisingly modern makeover. From automatic transcoding to subtitles that meet accessibility standards, the plugin packs a lot of punch without demanding a PhD in server administration. Sure, there are a few quirks – like any software that sits at the intersection of PHP, JavaScript, and FFmpeg – but the payoff is a richer, more engaging wiki that feels less like a static archive and more like a living media hub.

So, whether you’re curating a university’s lecture series, preserving cultural artifacts, or just want your community wiki to look less like a dusty textbook, TMH is worth a closer look. The code is open, the docs are solid, and the community is active. Dive in, tweak the settings, and let your pages speak – literally.

Subscribe to MediaWiki Tips and Tricks

Don’t miss out on the latest articles. Sign up now to get access to the library of members-only articles.
jamie@example.com
Subscribe