{"id":19212360,"url":"https://github.com/leafo/gifserver","last_synced_at":"2025-05-12T20:37:32.664Z","repository":{"id":18025434,"uuid":"21058374","full_name":"leafo/gifserver","owner":"leafo","description":"A server for transcoding gif to video on the fly","archived":false,"fork":false,"pushed_at":"2016-12-27T08:34:22.000Z","size":239,"stargazers_count":102,"open_issues_count":0,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T03:11:10.228Z","etag":null,"topics":["ffmpeg","gif","mp4"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/leafo.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":"2014-06-21T02:31:16.000Z","updated_at":"2024-08-12T02:59:40.000Z","dependencies_parsed_at":"2022-08-26T10:50:27.767Z","dependency_job_id":null,"html_url":"https://github.com/leafo/gifserver","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/leafo%2Fgifserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fgifserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fgifserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fgifserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafo","download_url":"https://codeload.github.com/leafo/gifserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249933552,"owners_count":21347698,"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":["ffmpeg","gif","mp4"],"created_at":"2024-11-09T13:46:41.782Z","updated_at":"2025-04-20T17:33:19.521Z","avatar_url":"https://github.com/leafo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# gifserver\n\n`gifserver` is a service written in Go that transcodes GIFs to videos on the\nfly. Useful for displaying user uploaded GIFs on a website without incurring\nslowdowns from excess bandwidth.\n\nThe server is a wrapper around `ffmpeg`, you must have the `ffmpeg` command\ninstalled on your system.\n\nThe server will automatically cache transcoded GIFs to disk so subsequent\nrequests will avoid the initial conversion time. The server is aware of what's\ncurrently being converted so multiple requests to the same GIF during a\nconversion do not trigger multiple conversions.\n\n## Install\n\n```bash\ngo get github.com/leafo/gifserver\n\ngifserver -help\n```\n\n## Running\n\n```bash\ngifserver\n```\n\nBy default the command will look for a config file named `gifserver.json` in\nthe current directory. You can override the config file's path with the\n`-config` command line flag.\n\nTo transcode a GIF just request the server at the `/transcode` path with the\nURL of the GIF you would like converted: (The `http://` is optional):\n\n```\nhttp://localhost:9090/transcode?url=leafo.net/dump/test.gif\n```\n\nThe type of video will be detected from the `Accept` header. If nothing could\nbe detected a MP4 is returned by default. If there are any problems an HTTP 500\nerror is returned and the server returns an error message.\n\nThe `/transcode` path takes the following query parameters:\n\n* **url** the url of the gif to load *(required)*\n* **format** the format to transcode to, either `mp4`, `ogv`, `png` *(optional)*\n\nUsing `png` as the format will return an image that has the first frame of the GIF.\n\n## Config\n\nA JSON file is used to configure the server. The default config is as follows:\n\n```json\n{\n\t\"Address\": \":9090\",\n\t\"Secret\": \"\",\n\t\"CacheDir\": \"gifcache\",\n\t\"MaxBytes\": 5242880,\n\t\"MaxWidth\": 512,\n\t\"MaxHeight\": 512,\n\t\"MaxConcurrency\": 0\n}\n```\n\nYour config can replace any combination of the defaults with your own values.\n\n* **Address** the address to bind the server to\n* **Secret** secret key to use for singed URLs. If `\"\"` is the secret key then signed URLs are disabled\n* **CacheDir** where to cache transcoded GIFs\n* **MaxBytes** the max size of GIF in bytes allowed to be processed, setting to 0 disabled\n* **MaxWidth** the max width of GIF that can be processed, setting to 0 disables\n* **MaxHeight** the max width of GIF that can be processed, setting to 0 disables\n* **MaxConcurrency** the max number of transcodes that can be in process at once, additional ones are queued. Setting to 0 disables\n\n## Signed URLs\n\nYou should used signed URLs whenever possible to avoid malicious users from\ntriggering a [denial-of-service-attack][0] on your server by sending a large\namount of conversion requests.\n\nTo enable signed URLs provide a `Secret` in your config file. The server uses\nSHA1 HMAC to generate signatures for URLs. Generating the signature is\nrelatively simple:\n\nGiven the following request to transcode a GIF:\n\n```\nhttp://localhost:9090/transcode?url=leafo.net/dump/test.gif\n```\n\nTake the entire path and query from the URL an perform a SHA1 HMAC digest on\nit. Base64 encode the sum. Then append the URL escaped signature to the end of\nthe URL as the query parameter `sig`:\n\n```\nsum = hmac_sha1(theSecret, \"/transcode?url=leafo.net/dump/test.gif\")\nsignature = encode_base64(sum)\n\nsigned_url = url + \"\u0026sig=\" + url_escape(signature)\n```\n\nThen perform the request with the signed URL. You should always append the\nsignature at the end of the URL. You must not change the order of the original\nquery parameters in any way when appending the signature otherwise the\nsignature is invalid.\n\n## Preventing Abuse\n\nA few config options to prevent malicious GIFs from blocking the server are\nincluded.\n\nMaxBytes, MaxWidth, and MaxHeight should all be set to reasonable values to\nprevent large images from being loaded and taking up a large amount of memory.\n\nMaxConcurrency should be set to prevent an influx of trascode requests from\ntaking over the CPU.\n\n## About\n\nAuthor: Leaf Corcoran (leafo) ([@moonscript](http://twitter.com/moonscript))  \nEmail: leafot@gmail.com  \nHomepage: \u003chttp://leafo.net\u003e  \nLicense: MIT, Copyright (C) 2014 by Leaf Corcoran\n\n\n  [0]: http://en.wikipedia.org/wiki/Denial-of-service_attack\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Fgifserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafo%2Fgifserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Fgifserver/lists"}