Skip to content

Commit

Permalink
Merge pull request #4337 from nklhtv/fix-segment-duration
Browse files Browse the repository at this point in the history
fix segment duration for VFR
  • Loading branch information
robwalch committed Dec 16, 2021
2 parents fdc9db8 + 84874a3 commit df19e16
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/mp4-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,10 @@ export function getDuration(data: Uint8Array, initData: InitData) {
const timescale = track.timescale || 90e3;
const truns = findBox(traf, ['trun']);
for (let j = 0; j < truns.length; j++) {
if (sampleDuration) {
rawDuration = computeRawDurationFromSamples(truns[j]);
if (!rawDuration && sampleDuration) {
const sampleCount = readUint32(truns[j], 4);
rawDuration = sampleDuration * sampleCount;
} else {
rawDuration = computeRawDurationFromSamples(truns[j]);
}
if (track.type === ElementaryStreamTypes.VIDEO) {
videoDuration += rawDuration / timescale;
Expand Down

0 comments on commit df19e16

Please sign in to comment.