Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mux_isom sometimes repeates ID3 emsg boxes in fragment files #2870

Open
3 tasks done
jadarve opened this issue Jun 12, 2024 · 2 comments
Open
3 tasks done

mux_isom sometimes repeates ID3 emsg boxes in fragment files #2870

jadarve opened this issue Jun 12, 2024 · 2 comments

Comments

@jadarve
Copy link

jadarve commented Jun 12, 2024

Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

  • I looked for a similar issue and couldn't find any.
  • I tried with the latest version of GPAC. Installers available at https://gpac.io/downloads/gpac-nightly-builds/
  • I give enough information for contributors to reproduce my issue (meaningful title, GitHub labels, platform, and compiler, command-line ...).

Running GPAC for generating an HLS/DASH stream with CMAF from a live TS stream containing ID3 tags, sometimes duplicates tags in the CMAF segments. It's hard to diagnose, but I managed to find a test file that can be used to reproduce the problem. I will share it privately.

gpac/bin/gcc/gpac \
-i example.ts \
-o gpac_local/playlist.mpd:gpac:dual:gpac:buf=-150:ll_part_hb=-1:seg_sync=no:segdur=1.0:cdur=0.2:llhls=sf:hlsc=true:cmaf=cmf2:dmode=dynamic:pssh=mv:template=segment:keep_segs=true

With the sample file, segment 1270 has 2 ID3 tags with the same content.

Adding some log lines here https://github.com/gpac/gpac/blob/master/src/filters/mux_isom.c#L6425 I don't see the logic for deduplicating emsg boxes being activated. The moof box always arrives with zero emsg boxes here.

Related to: #2865

@jadarve
Copy link
Author

jadarve commented Jun 12, 2024

Looking further into this, it looks as the problem of duplicated tags only appears when creating CMAF streams in fragmented mode. The original command:

gpac/bin/gcc/gpac \
-i example.ts \
-o gpac_local/playlist.mpd:gpac:dual:gpac:buf=-150:ll_part_hb=-1:seg_sync=no:segdur=1.0:cdur=0.2:llhls=sf:hlsc=true:cmaf=cmf2:dmode=dynamic:pssh=mv:template=segment:keep_segs=true

yields the following duplicated tag for one of the segments:

[styp] size=24
 - majorBrand: msdh
 - minorVersion: 0
 - compatibleBrand: msdh
 - compatibleBrand: msix
[moof] size=172
  [mfhd] size=16 version=0 flags=000000
   - sequenceNumber: 6346
  [traf] size=148
    [tfhd] size=24 version=0 flags=020022
     - trackID: 66
     - defaultBaseIsMoof: true
     - sampleDescriptionIndex: 1
     - defaultSampleFlags: 02000000 (isLeading=0 dependsOn=2 isDependedOn=0 hasRedundancy=0 padding=0 isNonSync=false degradationPriority=0)
    [tfdt] size=16 version=0 flags=000000
     - baseMediaDecodeTime: 438209280
    [trun] size=100 version=0 flags=000301
     - sampleCount: 10
[mdat] size=3464
[moof] size=172
  [mfhd] size=16 version=0 flags=000000
   - sequenceNumber: 6347
  [traf] size=148
    [tfhd] size=24 version=0 flags=020022
     - trackID: 66
     - defaultBaseIsMoof: true
     - sampleDescriptionIndex: 1
     - defaultSampleFlags: 02000000 (isLeading=0 dependsOn=2 isDependedOn=0 hasRedundancy=0 padding=0 isNonSync=false degradationPriority=0)
    [tfdt] size=16 version=0 flags=000000
     - baseMediaDecodeTime: 438228479
    [trun] size=100 version=0 flags=000301
     - sampleCount: 10
[mdat] size=3426
[emsg] size=355 version=1 flags=000000
 - timeScale: 90000
 - presentationTime: 438264456
 - eventDuration: 4294967295
 - id: 0
 - schedIdURI: https://aomedia.org/emsg/ID3
 - value: www.nielsen.com:id3:v1
 - messageData size=271: 49443304002000000205505249560000017b0000777777...
[moof] size=164
  [mfhd] size=16 version=0 flags=000000
   - sequenceNumber: 6348
  [traf] size=140
    [tfhd] size=24 version=0 flags=020022
     - trackID: 66
     - defaultBaseIsMoof: true
     - sampleDescriptionIndex: 1
     - defaultSampleFlags: 02000000 (isLeading=0 dependsOn=2 isDependedOn=0 hasRedundancy=0 padding=0 isNonSync=false degradationPriority=0)
    [tfdt] size=16 version=0 flags=000000
     - baseMediaDecodeTime: 438247679
    [trun] size=92 version=0 flags=000301
     - sampleCount: 9
[mdat] size=3285
[emsg] size=355 version=1 flags=000000
 - timeScale: 90000
 - presentationTime: 438264456
 - eventDuration: 4294967295
 - id: 0
 - schedIdURI: https://aomedia.org/emsg/ID3
 - value: www.nielsen.com:id3:v1
 - messageData size=271: 49443304002000000205505249560000017b0000777777..
[moof] size=164
  [mfhd] size=16 version=0 flags=000000
   - sequenceNumber: 6349
  [traf] size=140
    [tfhd] size=24 version=0 flags=020022
     - trackID: 66
     - defaultBaseIsMoof: true
     - sampleDescriptionIndex: 1
     - defaultSampleFlags: 02000000 (isLeading=0 dependsOn=2 isDependedOn=0 hasRedundancy=0 padding=0 isNonSync=false degradationPriority=0)
    [tfdt] size=16 version=0 flags=000000
     - baseMediaDecodeTime: 438264959
    [trun] size=92 version=0 flags=000301
     - sampleCount: 9
[mdat] size=3183
[moof] size=164
  [mfhd] size=16 version=0 flags=000000
   - sequenceNumber: 6350
  [traf] size=140
    [tfhd] size=24 version=0 flags=020022
     - trackID: 66
     - defaultBaseIsMoof: true
     - sampleDescriptionIndex: 1
     - defaultSampleFlags: 02000000 (isLeading=0 dependsOn=2 isDependedOn=0 hasRedundancy=0 padding=0 isNonSync=false degradationPriority=0)
    [tfdt] size=16 version=0 flags=000000
     - baseMediaDecodeTime: 438282239
    [trun] size=92 version=0 flags=000301
     - sampleCount: 9
[mdat] size=3208

where the duplicated tags are located in different fragments (moof boxes).

Running GPAC without fragment mode as:

gpac/bin/gcc/gpac \
-i example.ts \
-o gpac_local/playlist.mpd:gpac:dual:gpac:buf=-150:ll_part_hb=-1:seg_sync=no:segdur=1.0:llhls=sf:hlsc=true:cmaf=cmf2:dmode=dynamic:pssh=mv:template=segment:keep_segs=true

that is, without cdur=0.2, eliminates the duplicates. Unfortunately this is not an option for us as we want to use GPAC in low latency mode.

@rbouqueau
Copy link
Member

Thank for reporting and documenting. I plan to have a look at id3 soon as we spotted some potential regression related to our recent commits as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants