Skip to content

Commit

Permalink
When generating video thumbnails, in case no keyframes (I-frames) can…
Browse files Browse the repository at this point in the history
… be found, choose the nearest frame instead
  • Loading branch information
omanikhi committed Feb 26, 2025
1 parent 001d6ec commit d388b17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions VideoFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ public override void GetFileInfo(string path, long size)
// Overwrite output files
"-y",
// Select I-frames and set scale
$"-vf select=\"eq(pict_type\\,I),scale={width}:{height}" +
$"-vf select=\"eq(pict_type\\,I)+not(mod(n\\,10)),scale={width}:{height}" +
// Add cropping if requested
(crop ? (height > 0 ? $",crop=iw:'min({height},ih)'\"" : $",crop=iw:'min(iw/16*9,ih)'\"") : "\""),
// Output only one frame
"-vframes 1",
"-frames:v 1",
// Output format: image
"-f image2",
// Output to stdout
Expand Down

0 comments on commit d388b17

Please sign in to comment.