From 4e63879d18aceedbb26f16f306bda5f3170cae95 Mon Sep 17 00:00:00 2001 From: Paul Hieromnimon Date: Tue, 29 Oct 2024 13:02:41 -0600 Subject: [PATCH] use main image sequence source duration for marker track duration --- .../com/netflix/imflibrary/writerTools/IMPAssembler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/netflix/imflibrary/writerTools/IMPAssembler.java b/src/main/java/com/netflix/imflibrary/writerTools/IMPAssembler.java index 88ffdd03..3b97b0b8 100644 --- a/src/main/java/com/netflix/imflibrary/writerTools/IMPAssembler.java +++ b/src/main/java/com/netflix/imflibrary/writerTools/IMPAssembler.java @@ -61,7 +61,7 @@ public AssembledIMPResult assembleIMFFromFiles(SimpleTimeline simpleTimeline, Fi Map> sampleRateMap = new HashMap<>(); Map sampleCountMap = new HashMap<>(); Map hashMap = new HashMap<>(); - long videoIntrinsicDuration = 0; + long videoTotalSourceDuration = 0; for (Track track : simpleTimeline.getEssenceTracks()) { @@ -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( @@ -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));