{"id":17651771,"url":"https://github.com/diegovictor/video-thumbnailer","last_synced_at":"2025-05-07T07:16:21.675Z","repository":{"id":58169578,"uuid":"519808992","full_name":"DiegoVictor/video-thumbnailer","owner":"DiegoVictor","description":"Lambda to trigger a Fargate container that generates videos thumbnails after a file be uploaded and save it into S3","archived":false,"fork":false,"pushed_at":"2025-02-21T12:26:27.000Z","size":3643,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T08:42:46.021Z","etag":null,"topics":["aws","container","docker","fargate","ffmpeg","javascript","js","node","nodejs","s3","serverless","thumbnail","ts","typescript","video","video-processing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DiegoVictor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-31T15:09:39.000Z","updated_at":"2025-02-21T12:26:30.000Z","dependencies_parsed_at":"2024-04-16T13:45:43.846Z","dependency_job_id":"fcf153de-7483-47b8-a830-75aacd7b6ad9","html_url":"https://github.com/DiegoVictor/video-thumbnailer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fvideo-thumbnailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fvideo-thumbnailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fvideo-thumbnailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fvideo-thumbnailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/video-thumbnailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242930191,"owners_count":20208415,"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","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":["aws","container","docker","fargate","ffmpeg","javascript","js","node","nodejs","s3","serverless","thumbnail","ts","typescript","video","video-processing"],"created_at":"2024-10-23T11:43:36.072Z","updated_at":"2025-05-07T07:16:21.659Z","avatar_url":"https://github.com/DiegoVictor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Video Thumbnailer\n[![CircleCI](https://img.shields.io/circleci/build/github/DiegoVictor/video-thumbnailer?style=flat-square\u0026logo=circleci)](https://app.circleci.com/pipelines/github/DiegoVictor/video-thumbnailer?branch=main)\n[![serverless](https://img.shields.io/badge/serverless-4.9.0-FD5750?style=flat-square\u0026logo=serverless)](https://www.serverless.com/)\n[![eslint](https://img.shields.io/badge/eslint-8.57.0-4b32c3?style=flat-square\u0026logo=eslint)](https://eslint.org/)\n[![airbnb-style](https://flat.badgen.net/badge/style-guide/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![jest](https://img.shields.io/badge/jest-29.7.0-brightgreen?style=flat-square\u0026logo=jest)](https://jestjs.io/)\n[![typescript](https://img.shields.io/badge/typescript-5.8.2-3178c6?style=flat-square\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![coverage](https://img.shields.io/codecov/c/gh/DiegoVictor/video-thumbnailer?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/DiegoVictor/video-thumbnailer)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/video-thumbnailer/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\u003cbr\u003e\n[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=Video%20Thumbnailer\u0026uri=https%3A%2F%2Fraw.githubusercontent.com%2FDiegoVictor%2Fvideo-thumbnailer%2Fmain%2FInsomnia_2024-12-05.json)\n\nThis application trigger a container with ffmpeg to generate thumbnails when a video is uploaded into a S3 Bucket folder. Output example (compressed file for faster load):\n\n\u003cimg src=\"https://raw.githubusercontent.com/DiegoVictor/video-thumbnailer/main/output.jpg\" width=\"50%\" alt=\"Example\" /\u003e\n\n#### Infrastructure Diagram:\n\n![Infrastructure Diagram](https://raw.githubusercontent.com/DiegoVictor/video-thumbnailer/main/VideoThumbnailer.drawio.png)\n\n## Table of Contents\n* [Requirements](#requirements)\n* [Install](#install)\n  * [Deploy](#deploy)\n    * [Container](#container)\n      * [Useful Links](useful-links)\n  * [Teardown](#teardown)\n* [Usage](#usage)\n* [Running the tests](#running-the-tests)\n  * [Coverage report](#coverage-report)\n\n# Requirements\n* Node.js ^14.15.0\n* Serveless Framework\n* AWS Account\n  * [S3](https://aws.amazon.com/s3/)\n  * [Lambda](https://aws.amazon.com/lambda)\n  * [API Gateway](https://aws.amazon.com/api-gateway/)\n  * [Elastic Container Registry](https://aws.amazon.com/pt/ecr/)\n  * [Fargate](https://aws.amazon.com/pt/fargate/)\n\n# Install\n```\nnpm install\n```\nOr simply:\n```\nyarn\n```\n\u003e Was installed and configured the [`eslint`](https://eslint.org/) and [`prettier`](https://prettier.io/) to keep the code clean and patterned.\n\n## Deploy\nDeploy the application:\n```\n$ sls deploy\n```\nNow push the container image:\n```\n$ cd scripts\n$ ./deploy-container.sh\n```\n\nThe script will:\n\n1. Build the container image.\n2. Get authentication credentials in the ECR service.\n3. Push the container to the ECR repository created during the deploy.\n\n### Container\nThis container make usage of the [aws cli](https://aws.amazon.com/cli) to download the mp4 video file uploaded in the S3 Bucket, makes some calculations, then it uses [ffmpeg](https://ffmpeg.org/) binary to capture a thumbnail at each 1 second of video and save them into a single file.\n\u003e Refer to the `docker/main.sh` script.\n\nOnce the thumbnails file is generate it is uploaded into S3 Bucket.\n\n#### Useful Links\n* https://trac.ffmpeg.org/wiki/FilteringGuide\n* http://ffmpeg.org/ffmpeg-filters.html#streamselect_002c-astreamselect\n\n## Teardown\nTo completly remove the resources from AWS, follow these steps:\n1. Run the teardown script:\n```\n$ cd scripts\n$ ./teardown.sh\n```\n2. Then remove the stack:\n```\n$ sls remove\n```\nThat is all.\n\n# Usage\nAfter deploy the application use the outputed Lambda URL to request a signed URL to upload a video file:\n```\nGET /signedURL\n```\nThen use the `signedUrl` to upload the video file:\n```\nPUT \u003csigned URL\u003e\n```\nOnce the upload finish S3 will trigger a Lambda that will fire a container to generate the video thumbnails file, all you need to do is wait the generated file be uploaded in the same S3 Bucket in a folder called `preview`.\n\n# Running the tests\n[Jest](https://jestjs.io/) was the choice to test the app, to run:\n```\n$ yarn test\n```\nOr:\n```\n$ npm run test\n```\n\u003e Run the command in the root folder\n\n## Coverage report\nYou can see the coverage report inside `tests/coverage`. They are automatically created after the tests run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Fvideo-thumbnailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Fvideo-thumbnailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Fvideo-thumbnailer/lists"}