Skip to content

Commit

Permalink
Merge pull request #392 from Netflix/feature/use-source-duration-mark…
Browse files Browse the repository at this point in the history
…er-track

use main image sequence source duration for marker track duration
  • Loading branch information
pavlos authored Oct 29, 2024
2 parents 16933c9 + 4e63879 commit 1f012ff
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 1f012ff

Please sign in to comment.