Open Bug 1407261 Opened 7 years ago Updated 2 years ago

Rust MP4 demuxer not correctly reading the duration of file

Categories

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

defect

Tracking

()

People

(Reporter: jya, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Attached audio segment0.m4a
$ mp4dump.exe ~/Downloads/segment0.m4a
[ftyp] size=8+12
  major_brand = isom
  minor_version = 200
  compatible_brand = isom
[moov] size=8+651
  [mvhd] size=12+96
    timescale = 1000
    duration = 0
    duration(ms) = 0
  [trak] size=8+365
    [tkhd] size=12+80, flags=3
      enabled = 1
      id = 1
      duration = 4294967295
      width = 0.000000
      height = 0.000000
    [mdia] size=8+265
      [mdhd] size=12+20
        timescale = 44100
        duration = 4294967295
        duration(ms) = 97391548
        language = unk
      [hdlr] size=12+33
        handler_type = soun
        handler_name = SoundHandler
      [minf] size=8+180
        [smhd] size=12+4
          balance = 0
        [dinf] size=8+28
          [dref] size=12+16
            [url ] size=12+0, flags=1
              location = [local to file]
        [stbl] size=8+120
          [stsd] size=12+40
            entry-count = 1
            [.mp3] size=8+28
              data_reference_index = 1
          [stts] size=12+4
            entry_count = 0
          [stsc] size=12+4
            entry_count = 0
          [stsz] size=12+8
            sample_size = 0
            sample_count = 0
          [stco] size=12+4
            entry_count = 0
  [mvex] size=8+64
    [trex] size=12+20
      track id = 1
      default sample description index = 1
      default sample duration = 0
      default sample size = 0
      default sample flags = 0
    [trex] size=12+20
      track id = 2
      default sample description index = 1
      default sample duration = 0
      default sample size = 0
      default sample flags = 0
  [udat] size=8+90

So we can see using mp4dump that the file has a duration set in both the track header (tkhd) and media header (mdhd) is set. the movie header has a duration set at 0.

The rust mp4 demuxer returns a duration of 0 for this file. It shouldn't
Flags: needinfo?(ayang)
According to spec 14496-12 A.8 Fragmented movie files, "However the Movie Box does not contain the information for the full duration of the movie".

And the duration 4294967295 is 0xFFFFFFFF, do you really want demuxer return it?
Flags: needinfo?(ayang)
(In reply to Alfredo Yang (:alfredo) from comment #1)
> According to spec 14496-12 A.8 Fragmented movie files, "However the Movie
> Box does not contain the information for the full duration of the movie".

I think you're misreading the spec...
the introduction to this section is:
"This section introduces a technique that may be used in ISO files, where the construction of a single 
Movie Box in a movie is burdensome."

This only indicates that the duration may not been set in the MOOV... 
It doesn't state that if it is known it shouldn't be used.

> 
> And the duration 4294967295 is 0xFFFFFFFF, do you really want demuxer return
> it?

yes, this is a perfectly valid duration :)

stagefright logic was to use the mvhd duration if present, if not max(tkhd's duration)

That's what MP4Metadata code does, except that here the rust demuxer always return 0 for all of those.
Hi, I think it is a good first bug to familiar with mp4 rust codes.
Flags: needinfo?(cchang)
Assignee: ayang → attach-and-request

I'll put this on my todo list.

Flags: needinfo?(cchang)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: