"Save Snapshot As" option on HTML5 videos creates PNG files with .JPG file extension

VERIFIED FIXED in mozilla10

Status

()

VERIFIED FIXED
7 years ago
3 years ago

People

(Reporter: dholbert, Assigned: Dolske)

Tracking

Trunk
mozilla10
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [testday-20120302], URL)

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

7 years ago
STR:
 0. Be running Ubuntu Linux (I'm on 11.10 beta)

 1. Visit http://www.webmfiles.org/wp-content/uploads/video/big-buck-bunny_trailer.webm

 2. Right-click video, choose "Save Snapshot As"

 3. Try to open the resulting image in the default viewer, Gnome Image Viewer.

ACTUAL RESULTS:
It fails to open the image, giving this error message:
> Could not load image 'big-buck-bunny_trailer.jpg'.
> Error interpreting JPEG image file (Not a JPEG file: starts with 0x89 0x50)

So it appears the image might be corrupted in some way.  Other apps (Firefox, Gimp) seem to open the image just fine -- I'm not sure if this is from their image libraries being extra tolerant of minor image issues, or if the image is fine and Gnome Image Viewer is just buggy.

Filing this bug on whatever we might be able to do on the Gecko/Firefox side (encoding the JPG differently or something) to make this work.

VERSION INFORMATION:
Firefox Nightly user-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:10.0a1) Gecko/20111008 Firefox/10.0a1

Gnome Image Viewer (aka "eog" or "Eye of Gnome") package version:
3.2.0-0ubuntu1


(This might be better in Core | Video/Audio or Core | Imagelib.  Initially filing in Video Controls since this is a new available option, and I'm not sure what bits of Gecko code it uses into under the hood.)
(Reporter)

Updated

7 years ago
Summary: "Save Snapshot As" option on HTML5 videos creates JPG files which won't load in Gnome Image Viewer ("eog") → "Save Snapshot As" option on HTML5 videos creates JPG files which won't load in Gnome Image Viewer aka "eog", w/ error message "Not a JPEG file: starts with 0x89 0x50"
(Reporter)

Comment 1

7 years ago
Created attachment 565758 [details]
example JPG snapshot created by Firefox that won't load in eog

Here's an example JPG that triggers this, if saved & loaded in eog
(Reporter)

Comment 2

7 years ago
Created attachment 565759 [details]
screenshot of the error message in eog

Comment 3

7 years ago
IrfanView says it's a PNG with wrong extension. Works if renamed. 
(BTW, filesize is far too big IMHO)

Comment 4

7 years ago
Created attachment 565764 [details]
example JPG renamed as PNG

Updated

7 years ago
Attachment #565764 - Attachment description: example JPG renamrd as PNG → example JPG renamed as PNG

Comment 5

7 years ago
(In reply to Daniel Holbert [:dholbert] from comment #1)
> Created attachment 565758 [details]
> example JPG snapshot created by Firefox that won't load in eog

hah, even bugzilla calls it "image/png"

Comment 6

7 years ago
In fact I saw this error too. I asked the question why the snapshot gets PNG MIME type but shows JPG extension.
Cf https://bugzilla.mozilla.org/show_bug.cgi?id=681550#c14

Some image viewers  or image hosters may meet various issues to display/host such an image or a thumbnail of the image.
(Reporter)

Updated

7 years ago
Summary: "Save Snapshot As" option on HTML5 videos creates JPG files which won't load in Gnome Image Viewer aka "eog", w/ error message "Not a JPEG file: starts with 0x89 0x50" → "Save Snapshot As" option on HTML5 videos creates PNG files with .JPG file extension (won't load in Gnome Image Viewer aka "eog")

Comment 7

7 years ago
Maybe it would be useful to add an entry in about:config to choose between JPG/PNG (or more image formats), because saving PNG snapshots from 1080p HD videos (with rich contents like many colours/items e.g.) may imply a significant load/lag on the UI.

I tested with this 1080p video http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_stereo.ogg and some snapshots reached 5.8 MB.
(Reporter)

Comment 8

7 years ago
(In reply to Loic from comment #7)
> Maybe it would be useful to add an entry in about:config to choose between
> JPG/PNG

Perhaps supporting more than one output format would be useful -- but that should be tracked in a separate bug. Let's keep this bug on-topic.
(Assignee)

Comment 9

7 years ago
Hmm. The code is doing:

  canvas.toDataURL("image/jpg", "")

Maybe it's actually "image/jpeg"? Or maybe canvas is just broken?

We will at least need a spinoff bug to have canvas throw when an incorrect mimetype is specified.
(Assignee)

Updated

7 years ago
Summary: "Save Snapshot As" option on HTML5 videos creates PNG files with .JPG file extension (won't load in Gnome Image Viewer aka "eog") → "Save Snapshot As" option on HTML5 videos creates PNG files with .JPG file extension
(Assignee)

Comment 10

7 years ago
Created attachment 566137 [details] [diff] [review]
Trivial patch

Yeah, this is just a glitch with the specified mimetype. Tested a quick patch and got a real JPEG (and resulting file size dropped from ~160K to 22K for one testcase).
Attachment #565758 - Attachment is obsolete: true
Attachment #565759 - Attachment is obsolete: true
Attachment #565764 - Attachment is obsolete: true
(Assignee)

Comment 11

7 years ago
Trivial fix, so I went ahead and landed it. Will file followup for having <canvas> make more noise about this.

http://hg.mozilla.org/mozilla-central/rev/ccea01542d0b
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
(Assignee)

Comment 12

7 years ago
Filed bug 693539.
(Assignee)

Updated

7 years ago
No longer blocks: 697124

Comment 13

7 years ago
VERIFIED FIXED (JPEG from WebM) with Aurora Mozilla/5.0 (X11; Linux x86_64; rv:12.0a2) Gecko/20120302 Firefox/12.0a2

Updated

7 years ago
Whiteboard: [testday-20120302]
Marking VERIFIED based on comment #13
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.