Page MenuHomePhabricator

Thumbor thumbnails for WebM & Ogg videos with non square pixels have wrong aspect ratio
Closed, ResolvedPublic

Description

I noticed while testing some video files with non square pixels in the source file that thumbor-rendered thumbs for them are coming out with the wrong aspect ratio.

It seems to be pulling the aspect ratio of the raw buffer instead of scaling to the proper render dimensions as the previous system did.

An old thumb at right aspect: https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Xylocopa_violacea_male_-_2012-10-23.webm/800px--Xylocopa_violacea_male_-_2012-10-23.webm.jpg

A new thumb at wrong aspect: https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Xylocopa_violacea_male_-_2012-10-23.webm/804px--Xylocopa_violacea_male_-_2012-10-23.webm.jpg

Ogg Theora also affected when using non-square pixels:

In case those files get overwritten: expected 16:9 but getting 4:3.

Revisions and Commits

rTHMBREXT Thumbor Plugins
Restricted Differential Revision

Event Timeline

brion renamed this task from Thumbor thumbnails for WebM videos with non square pixels have wrong aspect ratio to Thumbor thumbnails for WebM & Ogg videos with non square pixels have wrong aspect ratio.Jun 25 2018, 5:10 AM
brion updated the task description. (Show Details)

Can get the base size and the display aspect ratio from ffprobe by extending the call to something like this:

$ ffprobe -v error -show_streams -select_streams v:0 -show_entries 'format=duration:stream=width,height,display_aspect_ratio:stream_tags=:stream_disposition=' -of default=noprint_wrappers=1:nokey=0 Xylocopa_violacea_male_-_2012-10-23.webm 
width=1440
height=1080
display_aspect_ratio=16:9
duration=82.440000

Will take a gander at patching the thumbor plugin later.

It's extracting a frame with ffmpeg, ideally that can somehow be made correct, without having to parse WebM-specific display_aspect_ratio, crop_* etc?

https://github.com/wikimedia/operations-debs-python-thumbor-wikimedia/blob/47fea15502b5248a76201adebe067cfbaf16f35e/wikimedia_thumbor/loader/video/__init__.py#L170-L200

Gilles triaged this task as Medium priority.
Gilles added a project: Performance-Team.
Gilles added a revision: Restricted Differential Revision.Jun 25 2018, 1:21 PM

Change 427612 had a related patch set uploaded (by Gilles; owner: Gilles):
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 2.0

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

Change 427612 merged by Filippo Giunchedi:
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 2.0

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

Fixed. Affected files can simply be purge to get correct thumbnail dimensions. I've already purged the 2 you mentioned in the task description.

*chef's kiss emoji* that's a perfect fix, and much simpler than extracting the info and adjusting size manually. Many thanks Gilles!

Vvjjkkii renamed this task from Thumbor thumbnails for WebM & Ogg videos with non square pixels have wrong aspect ratio to 4daaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Gilles as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from 4daaaaaaaa to Thumbor thumbnails for WebM & Ogg videos with non square pixels have wrong aspect ratio.Jul 2 2018, 10:23 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to Gilles.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.