Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/2d/src/lib/utils/video/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/2d/src/lib/utils/video/parser/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Loading