Page MenuHomePhabricator

TimedMediaHandler: retire ogv.js wasm codec shim
Closed, ResolvedPublic

Description

For some years we have included the ogv.js codec shim in TimedMediaHandler to play WebM and Ogg media on versions of IE, Edge, and Safari that didn't support them natively. Over time platforms have improved support for WebM, and we are now deploying alternate transcodes for older iOS devices using Motion-JPEG (hopefully to be replaced with MPEG-4 Visual) and MP3.

In short, there's no longer a need to include ogv.js in TimedMediaHandler: all current browsers can play our WebM videos and MP3 audios, and older iOS devices can be handled with the fallback codec well enough.

ogv.js is only maintained by me (bvibber) and nobody else code reviews it, so getting this library with its JS frontend and Wasm blob backends out of the production pipeline is a simplification for our security surface.

Steps:

  • Stub out public references to ogv.js setup in the JS classes in case anything's trying to launch a compatible startup
  • Remove all active references to ogv.js and the checks for native VP9 support in JS frontend
  • Remove ogv from the foreign-resources.yml dev deps
  • Remove the ogv.js dist
  • Profit!

Expected behavior changes from this patch:

  • iOS 17.3 and earlier, and a few older desktop setups, will let the <video> element error out instead of replacing it with an ogv.js shim player if there is not a compatible transcode present.
    • Plus: smaller security surface
    • Plus: less likely to encounter weird unexpected errors from ogv.js or the interface with video.js!
    • Minus: a few attempts to play a video on older devices will fail where a transcoded .mov file didn't get generated. Note we do not have any useful metrics for video playback except some old attempts to pull loading data from the hit logs and have no real idea if this will be impactful. Best way to follow this up is to poke at the transcode infrastructure.

Rough QA plan

Take a set of test videos if possible with .webm, .ogv and .mpg sources to exercise all code paths. Note that WebM sources may be VP8, VP9, or AV1 depending on the file and tool. Currently we're pushing VP9 in WebM transcodes.

_Note_ iOS 17.4 added WebM playback support to mobile Safari, but individual iOS 17 devices may or may not have a VP9 codec in the SoC. If someone happens to have such a device for testing, it should play back WebM containing VP8 -- such as the .360p.webm transcode or some original uploads -- but not VP9 or AV1. iOS 18-compatible devices all have a VP9 codec but do not all have an AV1 codec. AV1 support on iOS is currently untested by me --bv

  • Most browsers will see no change when all transcodes are available:
    • (web) iOS 11-17.3 plays .mov transcode
    • (app) iOS 11-17.3 plays .mov transcode
    • (web) iOS 18-26 plays .webm transcode
    • (app) iOS 18-26 plays .webm transcode
    • Desktop Safari plays .webm transcode
    • Firefox plays .webm transcode
    • Chrome plays .webm transcode
  • On videos with .webm transcode but missing .mov transcodes, iOS pre-17.4 will error out instead of trying to load ogv.js:
    • (web) iOS 11-17.3 will error out <- new behavior
    • (app) iOS 11-17.3 will error out <- new behavior
    • (web) iOS 18-26 plays .webm transcode
    • (app) iOS 18-26 plays .webm transcode
    • Desktop Safari plays .webm transcode
    • Firefox plays .webm transcode
    • Chrome plays .webm transcode
  • Videos with neither .webm transcode nor .mov transcode should will change iOS pre-17.4 to erroring out instead of trying to load ogv.js
    • (web) iOS 11-17.3 will error out <- new behavior
    • (app) iOS 11-17.3 will error out <- new behavior
    • (web) iOS 18-26 plays .webm VP8/VP9 source, or errors out
    • (app) iOS 18-26 plays .webm VP8/VP9 source, or errors out
    • Desktop Safari plays .webm VP8/VP9 or possibly MPEG-1/2 .mpg source, or errors out
    • Firefox plays .webm VP8/VP9/AV1 or .ogv source, or errors out
    • Chrome plays .webm VP8/VP9/AV1 source, or errors out

Event Timeline

Change #1079022 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/TimedMediaHandler@master] WIP removal of ogv.js (no longer needed)

https://gerrit.wikimedia.org/r/1079022

Change #1079023 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/MediaSearch@master] WIP removal of ogv.js codec shim (no longer needed)

https://gerrit.wikimedia.org/r/1079023

@bvibber do you want me to work on this and get it merged ? Are we confident enough in the current way forward ?

i looked through logstash, and still found considerable usage. Mostly this was all on files that still did not have the mjpeg derivative

@TheDJ yeah let's wait a while longer before killing it. In addition to needing to fix up the management interface & scripts for the damn transcodes so I can actually complete the backfill job, we _do_ kinda want to be able to play 'old versions' which the transcodes don't cover.

I think I'm going to withdraw this task and go a different direction: solidify a cleaned-up ogv.js 2.0 as the backup-player for raw source files, and in addition to old browsers use in in modern browsers when you pull up an .mpg (on any browser but Safari) or an .ogv (on Chrome which dropped Ogg or Safari which never had it).

That'll remain a low-prio task so I have to timebox it but it'll be fun to progress on it knowing I've still got some playback uses.

Change #1079022 abandoned by Bvibber:

[mediawiki/extensions/TimedMediaHandler@master] WIP removal of ogv.js (no longer needed)

Reason:

going a different direction, retooling ogv.js to concentrate on the no-transcodes case [old file versions, fresh uploads etc]

https://gerrit.wikimedia.org/r/1079022

Change #1079023 abandoned by Bvibber:

[mediawiki/extensions/MediaSearch@master] Removal of ogv.js codec shim (no longer needed)

Reason:

going a different direction, retooling ogv.js to concentrate on the no-transcodes case [old file versions, fresh uploads etc]

https://gerrit.wikimedia.org/r/1079023

Closing as declined, I'm going a different direction. We'll keep ogv.js as the backup-player for certain file types, not for primary viewing but for secondary cases like old versions, fresh uploads before a transcode is available, and working with a raw file before upload.

If I can extend ogv.js to support MPEG-1 and MPEG-2 video, which I think should be doable in a sensible way, that'll fill in some holes in access for raw video uploads in some browsers (eg Chrome dropped Ogg support, Safari never had it, and most browsers don't support MPEG-1 or MPEG-2)

If we're waiting longer before doing this, that's deferred not declined, surely?

Under my proposal above we'd keep it for the forseeable future to handle cases that we don't do transcodes for that not all supported browsers handle (Vorbis, Theora, VP9, AV1, MPEG-1, MPEG-2). (We could try to maintain and save transcodes for old versions instead, but this still doesn't handle pre-upload or the period between upload and the first compatible transcode being complete.)

bvibber removed bvibber as the assignee of this task.

Re-opening this to help simplify our setup, reduce bug & attack surface, etc vs current needs. Sometimes it still gets invoked and it can produce errors, which clog up logs etc and we're not going to take the time to track them down on sunsetting tech.

While it might be nice to include the other old codecs support for playback that's not covered well by current ogv.js and needs future development to be generally useful and I think it's fine to take it out entirely now, then re-add the future version in a different way in the future (if it comes to that).

Recommend retiring the old ogv.js setup interfaces much as outlined above to reduce future maintenance work by reducing dead code and rarely-used code low priority legacy code paths.

bvibber renamed this task from Retire ogv.js wasm codec shim to TimedMediaHandler: retire ogv.js wasm codec shim.Oct 27 2025, 8:14 PM
bvibber updated the task description. (Show Details)
egardner moved this task from Incoming/Inbox to Backlog on the Reader Growth Team board.

Adding this to my volunteer task stack. Removing from Reader Growth team.

Change #1297733 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/MediaSearch@master] Removal of ogv.js codec shim call

https://gerrit.wikimedia.org/r/1297733

Change #1297734 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/TimedMediaHandler@master] De-deploy ogv.js from TimedMediaHandler

https://gerrit.wikimedia.org/r/1297734

lgtm, but I'll test this weekend

small note for the future.

			.then( () => {
				this.player = window.videojs(
					this.$refs.videoPlayer,
					this.options,

We should probably export the variable from the RL plugin, so that we don't have to use globals in MediaSearch.

Change #1297733 merged by jenkins-bot:

[mediawiki/extensions/MediaSearch@master] Removal of ogv.js codec shim call

https://gerrit.wikimedia.org/r/1297733

Change #1297734 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] De-deploy ogv.js from TimedMediaHandler

https://gerrit.wikimedia.org/r/1297734