Closed Bug 1718468 Opened 4 years ago Closed 5 months ago

Firefox does not sniff matroka with incorrect mp4 extension

Categories

(Core :: Audio/Video: Playback, defect, P3)

Firefox 91
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: liamre, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

Visit https://files.catbox.moe/6w5twb.mp4 or https://jsfiddle.net/erwbf32g/show

Actual results:

The message "No video with supported format and MIME type found" is shown in the video player, and the error
Media resource https://files.catbox.moe/6w5twb.mp4 could not be decoded, error: Error Code: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006) Details: static MP4Metadata::ResultAndByteBuffer __cdecl mozilla::MP4Metadata::Metadata(mozilla::ByteStream *): Cannot parse metadata is logged in the console.

Expected results:

The video should have played, like in Chrome.

I forgot to mention this in the original report: the video is quite loud, so turn down your volume if you're going to play it.

https://files.catbox.moe/6w5twb.mp4 is not an mp4, it's a Matroska file. There's a couple of related problems with this:

  • Firefox doesn't support Matroksa files, though it does support the related webm format. You can see this file works in Firefox if it's renamed with a .webm extension. This renaming shouldn't be done in general, as not all Matroksa files are valid webm files, but it's proof of the issue here.
  • Firefox fails to detect the file as a Matroka file, so tries to parse it as an mp4.

We could improve the sniffing here, so Firefox realizes this is not an mp4, but since the file is a matroksa file, it may only make sense to do so should Firefox support Matroksa.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
See Also: → matroska
Summary: Certain MP4 cannot be decoded by Firefox (NS_ERROR_DOM_MEDIA_METADATA_ERR) → Firefox does not sniff matroka with incorrect mp4 extension

I don't understand why it works when renaming, it really shouldn't this is not a WebM file. The extension or even MIME type shouldn't be taken into consideration when playing back media file, only sniffing should be used.

I'll check with my patches in bug 1704115.

Flags: needinfo?(padenot)

(In reply to Paul Adenot (:padenot) from comment #3)

I don't understand why it works when renaming, it really shouldn't this is not a WebM file. The extension or even MIME type shouldn't be taken into consideration when playing back media file, only sniffing should be used.

Because our sniffer does not support (non-WebM) Matroska. When the sniffer fails to sniff a mime type from the content, it will sniff a mime type from the extension as a fallback. So the extension still matters.

See Also: → 1985336

The file is already invalid, so I can't verify it. But we have implemented the Matroska sniffing in bug 1985336. Please file a new one if the issue still presents.

Blocks: matroska
Status: NEW → RESOLVED
Closed: 6 months ago
Duplicate of bug: 1985336
Flags: needinfo?(padenot)
Resolution: --- → DUPLICATE
Attached image Screenshot.png

Invalid? I can still view https://files.catbox.moe/6w5twb.mp4 with Chrome, but Firefox Nightly still fails with the same error (NS_ERROR_DOM_MEDIA_METADATA_ERR) even though media.mkv.enabled is true. I can even download the file and playback it locally on Chrome.

If you really can't download the file, I'll attach it here. Do I really need to file a new bug just for this?

Flags: needinfo?(alwu)

Sorry, the issue was caused by my VPN. After disabling it, I was able to access the file. Reopening this bug.

Status: RESOLVED → REOPENED
No longer duplicate of bug: 1985336
Flags: needinfo?(alwu)
Resolution: DUPLICATE → ---
See Also: matroska

If I download the file and load it from local filesystem or python http.server, Nightly plays the video. X-Content-Type-Options: nosniff prevents the sniffing. ~~~But we do not comply with the spec. nosniff should not prevent us from sniffing media files according to the spec.~~~
Edit: Sorry, I was misreading the specs.

No longer blocks: matroska
Summary: Firefox does not sniff matroka with incorrect mp4 extension → Firefox does not sniff media files if the response header has X-Content-Type-Options: nosniff

The video is loading fine from the JSFiddle example (as expected.)

Blocks: matroska
Status: REOPENED → RESOLVED
Closed: 6 months ago5 months ago
Resolution: --- → WORKSFORME
Summary: Firefox does not sniff media files if the response header has X-Content-Type-Options: nosniff → Firefox does not sniff matroka with incorrect mp4 extension
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: