Closed Bug 693099 Opened 13 years ago Closed 13 years ago

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

Categories

(Toolkit :: Video/Audio Controls, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla10

People

(Reporter: dholbert, Assigned: Dolske)

References

()

Details

(Whiteboard: [testday-20120302])

Attachments

(1 file, 3 obsolete files)

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.)
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"
Here's an example JPG that triggers this, if saved & loaded in eog
Attached image screenshot of the error message in eog (obsolete) —
IrfanView says it's a PNG with wrong extension. Works if renamed. (BTW, filesize is far too big IMHO)
Attached image example JPG renamed as PNG (obsolete) —
Attachment #565764 - Attachment description: example JPG renamrd as PNG → example JPG renamed as PNG
(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"
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.
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")
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.
(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.
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.
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
Attached patch Trivial patchSplinter Review
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
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
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Filed bug 693539.
No longer blocks: 697124
Whiteboard: [mentor=jwein]
Whiteboard: [mentor=jwein]
VERIFIED FIXED (JPEG from WebM) with Aurora Mozilla/5.0 (X11; Linux x86_64; rv:12.0a2) Gecko/20120302 Firefox/12.0a2
Whiteboard: [testday-20120302]
Marking VERIFIED based on comment #13
Status: RESOLVED → VERIFIED
Assignee: nobody → dolske
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: