Open Bug 1593790 Opened 6 years ago Updated 3 years ago

createImageBitmap creates an untranslated version of videos

Categories

(Core :: Graphics: Canvas2D, defect, P3)

defect

Tracking

()

People

(Reporter: mossop, Unassigned)

Details

(Keywords: parity-chrome)

MP4 videos can include a matrix to translate the rendered video. This is commonly used to rotate the video to portrait for a video recorded as landscape. Firefox and Chrome correctly apply this matrix when rendering in a <video> element. However using createImageBitmap to capture a frame of a video that is translated in this fashion behaves differently in Firefox and Chrome.

In Chrome you get an ImageBitmap containing the translated image and width/height, so exactly what you see in the page. Rendering it in a canvas shows the same image.

In Firefox you get an ImageBitmap containing the untranslated image and the untranslated withd/height. I.e. for a landscape image that is translated to display as portrait the generated ImageBitmap is landscape. Rendering it to a canvas shows a rotated version of the frame.

The spec for createImageBitmap doesn't cover what should happen in this case but Chrome's behaviour makes the most sense to me, I would expect capturing a frame from a playing video to give a bitmap the same shape as the video.

Looks like this also impacts ctx.drawImage(video_element) on a canvas element.

Component: DOM: Core & HTML → Canvas: 2D
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.