Closed Bug 1275853 Opened 4 years ago Closed 4 years ago

Firefox 46.0.1 on Linux Mint and Win8 doesn't play mp4 videos encoded with variable bitrate

Categories

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

46 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox46 --- wontfix
firefox47 --- wontfix
firefox48 --- wontfix
firefox49 --- fixed

People

(Reporter: francesco, Assigned: jya, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: compat, regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160521140538

Steps to reproduce:

Firefox 46.0.1 doesn't play mp4 videos encoded with variable bitrate.
Both Linux and Windows versions seem affected (I tested it on Linux Mint and on Win8).
For example, this video is not played:
http://streaming.uninettuno.it/video/0d4d0343-c1d5-46d6-b561-d001252354f6/9_11_15_calcolo_e_algebra_lineare.mp4

Firefox can open similar videos encoded with fixed bitrate.
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Reg range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=dc352a7bf234&tochange=0753f7b93ab7

Probably due to:
Chris Pearce — Bug 1057879 - Enable MP4Reader on Windows. r=kentuckyfriedtakahe
Flags: needinfo?(jyavenard)
It's not because it's VBR that it doesn't play. But because this file is technically invalid.

First the content type is set as 'f4v' which is explicitly forbidden in the HTML5 spec: https://mimesniff.spec.whatwg.org/#signature-for-mp4
(it should be "mp4 ")

That's not why this file isn't playing however, it's because the Sample Description Box ("stsd") has an invalid size, it's marked as having a size of 225212 bytes, yet it only contains one box that has a size of 1118 bytes..

The libstagefright demuxer will error on such problem.

So this file is broken and should not play really. Yet, Chrome and Edge play it fine. So for compatibility perspective maybe we should have a work around for it.

Francesco, in the mean time you may want to fix the files with an utility such as ffmpeg, simply do something like:
   # ffmpeg -i 9_11_15_calcolo_e_algebra_lineare.mp4 -c:v copy -c:a copy -movflags +faststart 9_11_15_calcolo_e_algebra_lineare.fixed.mp4

This will fix all the problems in your files and will avoid any incompatibilities with any browser.

:rillian, I will craft a work around, but that will also need to be handled in the rust mp4 demuxer
Assignee: nobody → jyavenard
Flags: needinfo?(jyavenard) → needinfo?(giles)
Francesco, since you're using mint and it may be an older version, replace ffmpeg in the command above with avconv.

(avconv v9.18 found in mint 14.04 choke on the -movflags +faststart bit, which you definitely want if you intend your students to stream the content online).

So I suggest you download ffmpeg and compile it yourself.
Actually, there are many many more issues with this file ; which program did you use to generate it?

it's very broken.
Flags: needinfo?(francesco)
My guess is that the application generating those files, does a very rough estimate on what the sample table size is going to be, which allows to perform the conversion in a single pass. This allows to place the moov box at the beginning.

Review commit: https://reviewboard.mozilla.org/r/55976/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/55976/
Attachment #8757547 - Flags: review?(ajones)
Jean-Yves Avenard, I didn't generated that file and I cannot change it: that mp4 is a lesson of my university... and I'm a student. In the original page (that is protected by login), that mp4 is played throught Jwplayer. If the Firefox user has the Flash plugin enabled, Jwplayer uses it and the video is played well; if the Firefox user hasn't the Flash plugin, Jwplayer uses the built-in capability of Firefox to play mp4s, and it fails. The most of video-lessons of my university play in Firefox without problems, but few of them don't play (without Flash).

However, I have a blog and sometimes I needed to re-encode my mp4s to make them play on Firefox (the other browsers were able to play them). 

Thank you for your work in solving this issue. I hope that Firefox can be more tolerant of all kinds of mp4 :)
Flags: needinfo?(francesco)
Chrome plays it.
Keywords: compat
Priority: -- → P2
Francesco, could you link to a much smaller file that also doesn't play ?
It would help write a test so that those files will always be checked that they play correctly.
Flags: needinfo?(francesco)
Attachment #8757547 - Flags: review?(ajones) → review+
Comment on attachment 8757547 [details]
MozReview Request: Bug 1275853: [mp4] Don't reject boxes that contains padding but can be easily skipped. r?kentuckyfriedtakahe

https://reviewboard.mozilla.org/r/55976/#review52776

::: media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp:1175
(Diff revision 1)
>                      return err;
>                  }
>              }
>  
> -            if (*offset != stop_offset) {
> -                return ERROR_MALFORMED;
> +            // Some muxer add some padding after the stsd content. Skip it.
> +            *offset = stop_offset;

"Some muxers add some..."
Jean-Yves Avenard, I'm sorry, I haven't a much smaller file.
Comment on attachment 8757547 [details]
MozReview Request: Bug 1275853: [mp4] Don't reject boxes that contains padding but can be easily skipped. r?kentuckyfriedtakahe

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/55976/diff/1-2/
Attachment #8757547 - Attachment description: MozReview Request: Bug 1275853: [m[4] Don't reject boxes that contains padding and can be easily skipped. r?kentuckyfriedtakahe → MozReview Request: Bug 1275853: [mp4] Don't reject boxes that contains padding but can be easily skipped. r?kentuckyfriedtakahe
https://hg.mozilla.org/mozilla-central/rev/38c9fa1d2e59
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Given this is tracked as a regression in 47, should we uplift to beta?
Flags: needinfo?(rkothari)
(In reply to Andrew Overholt [:overholt] from comment #14)
> Given this is tracked as a regression in 47, should we uplift to beta?

Hello Andrew, this regression has been around since 46.0.1 (i.e. 5 weeks). I agree that it is a recent regression but would it lead to a dot release. The other concern is about taking uplifts in media/gfx components this late in the cycle. Let's ask Anthony for a second opinion on the risk involved in uplifting this to RC1 (uplift bar is potential release blockers and dot-release drivers only.)
Flags: needinfo?(ajones)
The regression has been there for much longer; it is a very simple fix however and has nothing to do with gfx. It can't introduce a regression.
(In reply to Jean-Yves Avenard [:jya] from comment #16)
> The regression has been there for much longer; it is a very simple fix
> however and has nothing to do with gfx. It can't introduce a regression.

This issue has existed on Windows for a very long time and a number of releases on Linux. I'm very confident that the fix is safe. The patch simply removes a case of unnecessarily returning ERROR_MALFORMED.

The issue is that we have a box of a known length. Inside that box we have a number of entries which we process. We were failing when we saw unexpected bytes. The fix simply ignores those bytes rather than failing.
Flags: needinfo?(ajones)
Blocks: 1300062
Alfredo, we need to check this one as well.
Flags: needinfo?(giles) → needinfo?(ayang)
(In reply to Ralph Giles (:rillian) needinfo me from comment #19)
> Alfredo, we need to check this one as well.

Yes, it has been fixed already in https://github.com/mozilla/mp4parse-rust/pull/31.
Flags: needinfo?(ayang)
Excellent. Thanks for checking.
You need to log in before you can comment on or make changes to this bug.