Open Bug 1947417 Opened 1 month ago Updated 29 days ago

Firefox fails to play mp4 video

Categories

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

Firefox 135
defect

Tracking

()

UNCONFIRMED

People

(Reporter: cristof, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0

Steps to reproduce:

  1. Record video with my phone
  2. Try to reproduce it in Firefox (as embedded into html or directly using File->Open)

Tested on Ubuntu and Debian Linux on two different computers.

My User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0

Actual results:

Firefox fails to play the video. "No video with supported format and MIME type found" error is displayed.

Following warning is displayed in console:

Media resource file:///home/kandrelczyk/Videos/signal-2025-02-11-104640.mp4 could not be decoded, error: Error Code: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006)
Details: virtual RefPtr<MP4Demuxer::InitPromise> mozilla::MP4Demuxer::Init(): Parse MP4 metadata failed

Expected results:

Firefox should reproduce the video.

Attached you can find example video. FFprobe reports it as:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'signal-2025-02-11-104640.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2025-02-11T09:46:41.000000Z
Duration: 00:00:02.31, start: 0.000000, bitrate: 1326 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
Metadata:
creation_time : 2025-02-11T09:46:41.000000Z
vendor_id : [0][0][0][0]
Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 480x848, 1223 kb/s, 30.31 fps, 29.83 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2025-02-11T09:46:41.000000Z
vendor_id : [0][0][0][0]
encoder : AVC Coding

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

The video seems to contain AUD NAL units Firefox doesn't like.

Track 1, sample format "avc1": in SPS NAL unit: 0 with no num_units_in_tick expected this field to be set
Track 1, sample format "avc1": in SPS NAL unit: 0 with no timescale expected this flag to be set

The file can be fixed by running

ffmpeg -i signal-2025-02-11-104640.mp4 -bsf:v h264_metadata=aud=remove -map 0 -c copy -movflags +faststart output.mp4

Thanks for checking. I did another test and sent the same file to my desktop using email instead of signal. The file now works correctly in Firefox.
Looks like Signal adds the AUD NAL units when transfering/saving files.

Are those units correct according to mp4 standard? If not I can report this to Signal instead.

Severity: -- → S4

The problem (if there is one) seems to be in this file: https://github.com/mozilla/mp4parse-rust/blob/master/mp4parse/src/lib.rs, more specifically here:

        if !esds.decoder_specific_data.is_empty() {
            return Status::EsdsDecSpecificIntoTagQuantity.into();
        }

For your file esds.decoder_specific_data.is_empty() returns false so the method returns with a failure code. The text associated with that failure code is "There can be only one DecSpecificInfoTag descriptor", although if we're checking for !empty then it would seem that one entry would be enough to cause a failure.

Eventually that code comes back to https://searchfox.org/mozilla-central/source/dom/media/mp4/MP4Metadata.cpp#100 and we get a NS_ERROR_DOM_MEDIA_METADATA_ERR

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: