Skip to content

Commit

Permalink
use main image sequence source duration for marker track duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Hieromnimon committed Oct 29, 2024
1 parent 16933c9 commit 4e63879
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public AssembledIMPResult assembleIMFFromFiles(SimpleTimeline simpleTimeline, Fi
Map<UUID, List<Long>> sampleRateMap = new HashMap<>();
Map<UUID, BigInteger> sampleCountMap = new HashMap<>();
Map<UUID, byte[]> hashMap = new HashMap<>();
long videoIntrinsicDuration = 0;
long videoTotalSourceDuration = 0;


for (Track track : simpleTimeline.getEssenceTracks()) {
Expand Down Expand Up @@ -159,7 +159,7 @@ public AssembledIMPResult assembleIMFFromFiles(SimpleTimeline simpleTimeline, Fi
logger.info("Adding file to resources: {}..", essenceTrackEntry.getFile().getName());

if (track.getSequenceTypeEnum().equals(Composition.SequenceTypeEnum.MainImageSequence)) {
videoIntrinsicDuration += sampleCount.longValue();
videoTotalSourceDuration += (essenceTrackEntry.getDuration() == null ? sampleCount : essenceTrackEntry.getDuration()).longValue();
}

trackFileResources.add(
Expand Down Expand Up @@ -209,9 +209,9 @@ public AssembledIMPResult assembleIMFFromFiles(SimpleTimeline simpleTimeline, Fi
markerResources.add(new IMFMarkerResourceType(
UUIDHelper.fromUUID(IMFUUIDGenerator.getInstance().generateUUID()),
editRate,
BigInteger.valueOf(videoIntrinsicDuration),
BigInteger.valueOf(videoTotalSourceDuration),
BigInteger.ZERO,
BigInteger.valueOf(videoIntrinsicDuration), // source duration may not be necessary
BigInteger.valueOf(videoTotalSourceDuration), // source duration may not be necessary
BigInteger.ONE,
markerList));

Expand Down

0 comments on commit 4e63879

Please sign in to comment.