diff --git a/ts/util/isVideoGoodForStories.ts b/ts/util/isVideoGoodForStories.ts index cecae0f8ea..091abe00b6 100644 --- a/ts/util/isVideoGoodForStories.ts +++ b/ts/util/isVideoGoodForStories.ts @@ -54,7 +54,11 @@ export async function isVideoGoodForStories( const mp4 = MP4Box.createFile(); await new Promise((resolve, reject) => { mp4.onReady = info => { - if (info.duration > MAX_VIDEO_DURATION) { + // mp4box returns a `duration` in `timescale` units + const seconds = info.duration / info.timescale; + const milliseconds = seconds * 1000; + + if (milliseconds > MAX_VIDEO_DURATION) { reject(ReasonVideoNotGood.TooLong); return; }