Opened 4 years ago

Closed 4 years ago

#5178 closed defect (needs_more_info)

isom cannot be a MAJOR BRAND in MP4 created from ffmpeg

Reported by: richardbushell Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Dear ffmpeg team

isom cannot be a MAJOR BRAND in MP4, please could you apply a fix to correctly record this by default as:

<FileTypeBox? MajorBrand?="mp42" MinorVersion?="0">

'isom' cannot be used as a major brand, it is currently prohibited by ISO/IEC 14496-12 sec 6.3 paragraph 2.

This is causing problems down the line!

Change History (16)

comment:1 Changed 4 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords mov added

What kind of problems?

comment:2 Changed 4 years ago by richardbushell

MPEG-DASH conformance problems, and video players not knowing the correct ftyp.
It should be mp42 not isom, as per the spec.

comment:3 Changed 4 years ago by cehoyos

Iirc, FFmpeg does not write mp42-compatible files, only mp41.
Did you test with the -brand option?

Which player doesn't recognize the isom major brand?

comment:4 Changed 4 years ago by richardbushell

We did try the ffmpeg -brand option, but it doesn't have a MINOR VERSION option!

At the moment we have to incorporate an extra step with MP4Box as this supports a Minor Version option after a colon, i.e:-
MP4Box -brand mp42:0 file.mp4
(obviously this should be mp41:0 if you write mp41 currently).

Your brand option leaves the Minor Version as 512, and it should be 0.

Why not write mp41 and 0 to these by default anyway, rather than add a minor version option to -brand? That would meet the spec.

See:
http://www.ftyps.com/composite.htm#6.3

comment:5 Changed 4 years ago by cehoyos

Why should the minor version for mp41 be 0?

comment:6 Changed 4 years ago by cehoyos

Can you confirm that your actual issue is not that FFmpeg does not write files compatible with mp42? You could use a binary efitor to test if the minor version really makes any difference.
If you can point me to the player in question, I would be able to test myself.

comment:7 Changed 4 years ago by richardbushell

512 is written currently (which I believe is the Minor Version for ISOM). Obviously your -brand option doesn't change this.

Can you confirm whether whether ffmpeg definitely writes mp41 (or mp42) files. And if so, I'd also need to re-check what the Minor Brand value should be.

Yes, MP4Box -brand mp42:0 does overwrite these values anyway so need need to use a binary editor. Without changing the Minor Version MPEG-DASH conformance tool throws an error reporting it as invalid value.

We've been changing this value for some time using MP4Box, which solves the problem. But I thought I'd best flag it with yourselves as it would be great to fix it. ISOM can be listed as a Compatible brand, but not a Major brand as per the specs. If corrected, we could omit the MP4Box step.

comment:8 Changed 4 years ago by richardbushell

Interestingly, if I change the brand via MP4Box to:-
major brand: mp41 (rather than mp42)
minor version: 0

THEN I get a Dash Conformance Error:
http://dashif.org/conformance.html
Using MPD: https://living.video/MPD/hotel.mpd

ERROR AS BELOW:
### error: moov-1:trak-1:tkhd-1
### 'tkhd' trackWidth must be set to one of (0, (320L << 16))
### error: moov-1:trak-1:tkhd-1
### 'tkhd' trackHeight must be set to one of (0, (240L << 16))
Warning: You signal brand MP4v1 and there ImageDescription? width must be 320 not 768
Warning: You signal brand MP4v1 and there ImageDescription? height must be 240 not 432

Yet, when I use Major Brand mp42 it results in no error at all.

comment:9 Changed 4 years ago by cehoyos

Your posts are a little confusing, please try to clarify a few things:
You write that you want us to change major_brand and minor_version in libavformat/movenc.c (that is correct, isn't it?) which is of course trivial. But I suspect this would not fix your actual problem which is - if I understand correctly - playback with some player: When you write "if I change the brand via MP4Box", please understand that MP4Box does not just change the brand but it actually writes a new, different file with (many) different properties, not just the brand.
So please either use a binary editor to change the values in the file produced by FFmpeg (and test) or simply change 0x200 in the line int minor = 0x200; in libavformat/movenc.c to 0 and test. If this really fixes your issue, please clarify this here and it will get fixed quickly.
If - as I expect - this is not sufficient, please explain how we can reproduce your (actual!) issue: Which player refuses FFmpeg's files?

comment:10 Changed 4 years ago by richardbushell

I need to know definitively if ffmpeg is writing MP4v1 or MP4v2, so mp41 or mp42. Whichever it is that should be written as the Major Brand. The Minor Version should be 0 unless you know otherwise.

Isom should not be the Major Brand, just a Compatible brand. So, we need to change this, not just the Minor Version.

We don't use MP4Box in our workflow at all for any other purpose other than just to write the Major Brand and Version Number. If we don't change this then the standard ffmpeg mp4 output file fails conformance complaining of isom being used as a Major Brand. MP4Box is only changing the Brand and Version Number, nothing else.

I can work through the problem, but as a starting point we need to know if ffmpweg is writing mp41 or mp42. If mp41 (as you think) then changing the brand to mp41 also results in a Conformance error (as in my post above about ImageDescription? width and height being >320 and >240 respectively. Is mp41 standard constrained to sizes < 320x240 ???

When we change the brand to mp42 it does pass conformance (but you don't think it is mp42).

Can you find out if ffmpeg is actually writing mp42 (not mp41)? Whatever brand flags need recording is based on knowing this. We can then work through the issue, maybe just needs these values changing in libavformat/movenc.c

comment:11 Changed 4 years ago by richardbushell

For clarification, we are using: libx264
on the ffmpeg commandline for the mp4 creation.

comment:12 Changed 4 years ago by cehoyos

If you want your issue fixed please try to answer my questions. If you don't understand them, please say so.

comment:13 Changed 4 years ago by richardbushell

If ffmpeg libx264 is actually writing mp42 format mp4 files, then the question is actually answered. Can you find out?

comment:14 Changed 4 years ago by cehoyos

To make this a valid ticket, please:
Provide the FFmpeg command line that allows to reproduce the issue together with the complete, uncut console output and explain how we can reproduce the issue, ie which player refuses to play the output file.

comment:15 Changed 4 years ago by mulvya

Last edited 4 years ago by mulvya (previous) (diff)

comment:16 Changed 4 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed

Please reopen this ticket if you can add the missing information.

Note: See TracTickets for help on using tickets.