Skip to content

Commit

Permalink
fix: if stream has no duration, use the duration of the file for the …
Browse files Browse the repository at this point in the history
…still check
  • Loading branch information
Julusian committed Feb 2, 2024
1 parent 78962fc commit 1f71ae6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ function generateCinf(config: Record<string, any>, doc: MediaDocument, json: any
audioDur = parseFloat(stream.duration)
}
} else if (stream.codec_type === 'video') {
if (
Number(stream.duration ?? '0') < stillLimit ||
stream.disposition.attached_pic === 1 ||
stream.codec_name === 'gif'
) {
// Sometimes the stream has no duration, so fallback to using the file duration
const streamDuration = Number(stream.duration || json.format.duration) || 0

if (streamDuration < stillLimit || stream.codec_name == 'gif' || stream.disposition.attached_pic === 1) {
if (!stillTb) stillTb = [0, 1]
} else {
if (!videoTb) {
Expand Down

0 comments on commit 1f71ae6

Please sign in to comment.