diff --git a/packages/2d/src/lib/utils/video/parser/parser.ts b/packages/2d/src/lib/utils/video/parser/parser.ts index 7baab86b..b98f07c6 100644 --- a/packages/2d/src/lib/utils/video/parser/parser.ts +++ b/packages/2d/src/lib/utils/video/parser/parser.ts @@ -57,7 +57,7 @@ async function getFileInfo(uri: string) { const edits = editsWithoutFps.map(edit => { const trackDurationInSec = track.duration / track.timescale; const segmentDurationInSec = - edit.segmentDuration / track.movie_timescale; + edit.segmentDuration / track.timescale; const segmentFrames = track.nb_samples * (segmentDurationInSec / trackDurationInSec); const mediaRate = @@ -209,7 +209,7 @@ export class Mp4Parser { private getSecondDurationOfSegment(edit: Edit) { const mediaRate = edit.mediaRateInteger + edit.mediaRateFraction / 0xffff; const duration = - edit.segmentDuration / this.file.getInfo().videoTracks[0].movie_timescale; + edit.segmentDuration / this.file.getInfo().videoTracks[0].timescale; return duration / mediaRate; } diff --git a/packages/2d/src/lib/utils/video/parser/segment.ts b/packages/2d/src/lib/utils/video/parser/segment.ts index bc9311ab..4ebb6cf3 100644 --- a/packages/2d/src/lib/utils/video/parser/segment.ts +++ b/packages/2d/src/lib/utils/video/parser/segment.ts @@ -59,7 +59,7 @@ export class Segment { const segmentDurationInSeconds = this.edit.segmentDuration / - this.file.getInfo().videoTracks[0].movie_timescale; + this.file.getInfo().videoTracks[0].timescale; const framesToFill = Math.ceil(segmentDurationInSeconds * this.edit.fps); const height = this.file.getInfo().videoTracks[0].track_height; @@ -224,7 +224,7 @@ export class Segment { // Check if we are past the segment duration. const segmentDurationInSec = this.edit.segmentDuration / - this.file.getInfo().videoTracks[0].movie_timescale; + this.file.getInfo().videoTracks[0].timescale; const segmentEndTime = mediaTimeInSec + segmentDurationInSec; if (frameTimeInSec > segmentEndTime) { frame.close();