philipjscott / simple-thumbnail

A library that produces thumbnails from images, videos and URLs :mag_right:
https://www.npmjs.com/package/simple-thumbnail
MIT License
25 stars 14 forks source link

Feature Request: Add time-seeking #22

Closed philipjscott closed 5 years ago

philipjscott commented 5 years ago

Is your feature request related to a problem? Please describe.

I want to be able to generate a thumbnail at an arbitrary time.

Describe the solution you'd like

I would like to be able to pass in a time to FFmpeg, eg. -ss 00:01:00. The time should be passed in the config object:

genThumbnail('path/to/video.webm', 'output/file/path.png', '250x?', {
  time: '00:01:00'
})

If the seek fails, the operation should be a no-op (ie. what FFmpeg does already).

Describe alternatives you've considered

I've considered throwing an error if FFmpeg fails to seek, however, developers can check whether a seek is valid using ffprobe (see https://www.npmjs.com/package/ffprobe-client). By default, FFmpeg simply performs a no-op if the seek isn't valid; there's no need to deviate from the status quo.