{"id":13529850,"url":"https://github.com/transitive-bullshit/ffmpeg-generate-video-preview","last_synced_at":"2025-10-24T09:56:04.795Z","repository":{"id":47165952,"uuid":"127816844","full_name":"transitive-bullshit/ffmpeg-generate-video-preview","owner":"transitive-bullshit","description":"Generates an attractive image strip or GIF preview from a video.","archived":false,"fork":false,"pushed_at":"2018-08-09T15:23:16.000Z","size":2329,"stargazers_count":157,"open_issues_count":6,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-03T04:49:06.267Z","etag":null,"topics":["ffmpeg","fluent-ffmpeg","gif","preview","video"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitive-bullshit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-02T21:55:13.000Z","updated_at":"2025-08-18T01:35:04.000Z","dependencies_parsed_at":"2022-08-03T05:15:31.872Z","dependency_job_id":null,"html_url":"https://github.com/transitive-bullshit/ffmpeg-generate-video-preview","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/transitive-bullshit/ffmpeg-generate-video-preview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-generate-video-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-generate-video-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-generate-video-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-generate-video-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitive-bullshit","download_url":"https://codeload.github.com/transitive-bullshit/ffmpeg-generate-video-preview/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-generate-video-preview/sbom","scorecard":{"id":897011,"data":{"date":"2025-08-11","repo":{"name":"github.com/transitive-bullshit/ffmpeg-generate-video-preview","commit":"7d007e54eff5e6e99afd5d71e75dbc5fee0a1217"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"70 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-257v-vj4p-3w2h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-h726-x36v-rx45","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-gp95-ppv5-3jc5","Warn: Project is vulnerable to: GHSA-54xq-cgqr-rpm3","Warn: Project is vulnerable to: GHSA-wpg7-2c88-r8xv","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-x2mc-8fgj-3wmr","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T14:06:18.982Z","repository_id":47165952,"created_at":"2025-08-24T14:06:18.982Z","updated_at":"2025-08-24T14:06:18.982Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280776483,"owners_count":26388950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","fluent-ffmpeg","gif","preview","video"],"created_at":"2024-08-01T07:00:39.994Z","updated_at":"2025-10-24T09:56:04.752Z","avatar_url":"https://github.com/transitive-bullshit.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# ffmpeg-generate-video-preview\n\n\u003e Generates an attractive image strip or GIF preview from a video.\n\n[![NPM](https://img.shields.io/npm/v/ffmpeg-generate-video-preview.svg)](https://www.npmjs.com/package/ffmpeg-generate-video-preview) [![Build Status](https://travis-ci.com/transitive-bullshit/ffmpeg-generate-video-preview.svg?branch=master)](https://travis-ci.com/transitive-bullshit/ffmpeg-generate-video-preview) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n---\n\nExample 6x5 image strip preview (video credit [Big Buck Bunny](https://peach.blender.org/download/)).\n\n![Image Strip Example](https://raw.githubusercontent.com/transitive-bullshit/ffmpeg-generate-video-preview/master/media/big-buck-bunny-6x5.jpg)\n\n```sh\ngenerate-video-preview big-buck-bunny.avi output.jpg --width 160 --rows 5 --cols 6\n```\n\n---\n\nExample 6x5 image strip preview with black padding and margin.\n\n![Image Strip Example with Padding](https://raw.githubusercontent.com/transitive-bullshit/ffmpeg-generate-video-preview/master/media/big-buck-bunny-6x5-padding.jpg)\n\n```sh\ngenerate-video-preview big-buck-bunny.avi output.jpg --width 160 --rows 5 --cols 6 --padding 4 --margin 4\n```\n\n---\n\nExample gif preview with 30 frames at 4 fps.\n\n![GIF Example](https://raw.githubusercontent.com/transitive-bullshit/ffmpeg-generate-video-preview/master/media/big-buck-bunny-30.gif)\n\n```sh\ngenerate-video-preview big-buck-bunny.avi output.gif --width 320 --num-frames 30 --gif-fps 4\n```\n\n---\n\n## Install\n\n```bash\nnpm install --save ffmpeg-generate-video-preview\n\n# or if you want to use the CLI\nnpm install -g ffmpeg-generate-video-preview\n```\n\nThis module requires [ffmpeg](http://ffmpeg.org/) to be installed.\n\nIf you want to generate GIFs, you must also install [gifski](https://gif.ski/). On Mac OS, you can run\n\n```sh\nbrew install gifski\n```\n\n## CLI\n\n```sh\n  Usage: generate-video-preview [options] \u003cinput\u003e \u003coutput\u003e\n\n  Options:\n\n    -V, --version                 output the version number\n    -w, --width \u003cwidth\u003e           frame width\n    -h, --height \u003cheight\u003e         frame height\n    -q, --quality \u003cn\u003e             frame image quality\n    -n, --num-frames \u003cn\u003e          number of frames to capture\n    -p, --num-frames-percent \u003cn\u003e  number of frames to capture as % of overall frames\n    -P, --padding \u003cn\u003e             image strip tile padding (default: 0)\n    -M, --margin \u003cn\u003e              image strip border margin (default: 0)\n    -r, --rows \u003cn\u003e                image strip number of rows\n    -c, --cols \u003cn\u003e                image strip number of cols\n    -C, --color \u003ccolor\u003e           image strip background color (default: Black)\n    -f, --gif-fps \u003cn\u003e             gifski fps (default: 10)\n    -Q, --gif-quality \u003cn\u003e         gifski quality (default: 80)\n    -F, --gif-fast                enable gifski fast mode\n    -h, --help                    output usage information\n```\n\n## Usage\n\n```js\nconst generatePreview = require('ffmpeg-generate-video-preview')\n\nconst metadata = await generatePreview({\n  input: 'media/1.mp4',\n  output: 'preview.gif',\n  width: 128\n})\n\nconsole.log(metadata)\n// =\u003e {\n//   output: 'preview.gif',\n//   numFrames: 5,\n//   width: 128,\n//   height: 72\n// }\n```\n\n## API\n\n### generatePreview(options)\n\nGenerates a preview image strip or GIF from a video file. Returns a `Promise` for when the output file(s) have been written.\n\nNote that some options only target image strips, and some only target GIFs.\n\n#### options\n\n##### input\n\nType: `String`\n\nPath or URL to a video file.\n\n##### output\n\nType: `String`\n\nPath to a `jpg`, `png`, or `gif` file to output. If `output` is a `gif`, then a GIF will be created via `gifski`; otherwise, an image strip will be generated according to `rows` and `cols`.\n\n##### width\n\nType: `Number`\n\nScales the input to the specified width. If `height` isn't specified, the aspect ratio of the input will be preserved.\n\n##### height\n\nType: `Number`\n\nScales the input to the specified height. If `width` isn't specified, the aspect ratio of the input will be preserved.\n\n##### quality\n\nType: `Number`\nDefault: `2`\n\nIf exporting a jpeg image, the quality from 1-31 with 31 being the worst quality ([source](https://stackoverflow.com/questions/10225403/how-can-i-extract-a-good-quality-jpeg-image-from-an-h264-video-file-with-ffmpeg)).\n\nIf exporting a GIF, this will dictate the image quality of the intermediate frames, not the final output gif quality. Also see `gifski.quality`.\n\n##### numFrames\n\nType: `Number`\n\nSpecify an exact number of frames to capture. Note that if you specify `rows` and `cols` for image strips, this value will be overridden.\n\n##### numFramesPercent\n\nType: `Number`\nDefault: `0.05`\n\nSpecify a percentage of frames to capture as a floating point number between 0 and 1. Defaults to 5%. Note that if you specify `numFrames` or `rows` and `cols` for image stripsgifs, this value will be overridden.\n\n##### rows\n\nType: `Number`\nDefault: `1`\n(*Image Strips Only)*\n\nNumber of rows to generate in an image strip. See the ffmpeg [tile filter](https://ffmpeg.org/ffmpeg-filters.html#tile) for details.\n\nDefaults to one long horizontal image strip with one row.\n\n##### cols\n\nType: `Number`\n(*Image Strips Only)*\n\nNumber of columns to generate in an image strip. See the ffmpeg [tile filter](https://ffmpeg.org/ffmpeg-filters.html#tile) for details.\n\nNote that if `cols` isn't specified, it will be inferred. Also note that specifying both `rows` and `cols` is the easiest way to specify the number of frames to generate in an image strip.\n\n##### padding\n\nType: `Number`\nDefault: `0`\n(*Image Strips Only)*\n\nAdds a padding between each image in an image strip. See the ffmpeg [tile filter](https://ffmpeg.org/ffmpeg-filters.html#tile) for details.\n\n##### margin\n\nType: `Number`\nDefault: `0`\n(*Image Strips Only)*\n\nAdds an outer margin to an image strip. See the ffmpeg [tile filter](https://ffmpeg.org/ffmpeg-filters.html#tile) for details.\n\n##### color\n\nType: `String`\nDefault: `Black`\n(*Image Strips Only)*\n\nBackground color for unused areas of the image strip. May be any valid ffmpeg [color syntax string](https://ffmpeg.org/ffmpeg-utils.html#color-syntax).\n\n##### gifski\n\nType: `Object`\nDefault: `{ fps: 10, quality: 80, fast: false }`\n(*GIFs Only)*\n\n[Gifski](https://gif.ski/) customization options. Run `gifski -h` for details.\n\n##### log\n\nType: `Function`\nDefault: `noop`\n\nOptional function to log the underlying ffmpeg and gifski command(s). You may, for example, use `console.log`\n\n## Related\n\n- [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) - A fluent API to [FFmpeg](http://ffmpeg.org/).\n- [gifski](https://gif.ski/) - High quality GIF encoder.\n- [ffmpeg tutorial](https://www.binpress.com/tutorial/how-to-generate-video-previews-with-ffmpeg/138) - Related blog post by Martin Sikora from 2014.\n- [ffmpeg-extract-frames](https://github.com/transitive-bullshit/ffmpeg-extract-frames) - Extracts frames from a video using [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg).\n- [awesome-ffmpeg](https://github.com/transitive-bullshit/awesome-ffmpeg) - A curated list of awesome ffmpeg resources with a focus on JavaScript.\n\n## License\n\nMIT © [Travis Fischer](https://github.com/transitive-bullshit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-generate-video-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-generate-video-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-generate-video-preview/lists"}