All Projects → leafo → Gifserver

leafo / Gifserver

A server for transcoding gif to video on the fly

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Gifserver

Ffmpegcommand
FFmpegCommand适用于Android的FFmpeg命令库,实现了对音视频相关的处理,能够快速的处理音视频,大概功能包括:音视频剪切,音视频转码,音视频解码原始数据,音视频编码,视频转图片或gif,视频添加水印,多画面拼接,音频混音,视频亮度和对比度,音频淡入和淡出效果等
Stars: ✭ 394 (+294%)
Mutual labels:  ffmpeg, gif, mp4
canvas-capture
Record the canvas as an image, mp4 video, or gif from the browser
Stars: ✭ 35 (-65%)
Mutual labels:  ffmpeg, mp4, gif
Gifify
😻 Convert any video file to an optimized animated GIF.
Stars: ✭ 5,792 (+5692%)
Mutual labels:  ffmpeg, gif, mp4
Node Sorry
生成表情gif
Stars: ✭ 90 (-10%)
Mutual labels:  ffmpeg, gif
Jvedio
Windows desktop application to manage local video;Support baidu AI, youdao translation;Support FFMPEG video processing;Support multi-database management and statistics;Support skin switching
Stars: ✭ 545 (+445%)
Mutual labels:  ffmpeg, gif
Axiom
An FFmpeg GUI for Windows
Stars: ✭ 560 (+460%)
Mutual labels:  ffmpeg, mp4
Ffmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git
Stars: ✭ 27,382 (+27282%)
Mutual labels:  ffmpeg, mp4
Quick Media
media(audio/image/qrcode/markdown/html/svg) support web service (多媒体编辑服务, 酷炫二维码, 音频, 图片, svg, markdown, html渲染服务支持)
Stars: ✭ 612 (+512%)
Mutual labels:  ffmpeg, gif
Ffmediaelement
FFME: The Advanced WPF MediaElement (based on FFmpeg)
Stars: ✭ 733 (+633%)
Mutual labels:  ffmpeg, mp4
Webxdownloader
Browser extension to download Webex meeting recordings
Stars: ✭ 52 (-48%)
Mutual labels:  ffmpeg, mp4
Ar Gif
Easy to use augmented reality web components
Stars: ✭ 52 (-48%)
Mutual labels:  gif, mp4
Sickbeard mp4 automator
Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
Stars: ✭ 1,142 (+1042%)
Mutual labels:  ffmpeg, mp4
Mediatoolkit
A .NET library to convert and process all your video & audio files.
Stars: ✭ 492 (+392%)
Mutual labels:  ffmpeg, mp4
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (+297%)
Mutual labels:  ffmpeg, mp4
Trinity
android video record editor muxer sdk
Stars: ✭ 609 (+509%)
Mutual labels:  ffmpeg, mp4
Gifgen
Simple high quality GIF encoding
Stars: ✭ 397 (+297%)
Mutual labels:  ffmpeg, gif
Gifcompressor
An Android tool to compresses your GIFs into lightweight MP4 video using fast, hardware-accelerated encoders. Supports cropping, rotation, GIF concatenation and much more.
Stars: ✭ 85 (-15%)
Mutual labels:  gif, mp4
p5.rec
🍿 p5.rec lets you record your p5.js sketches and convert them to mp4 in your browser ▶️
Stars: ✭ 70 (-30%)
Mutual labels:  ffmpeg, mp4
poc-mp4-websocket
Streaming MP4 over Websocket using BMFF
Stars: ✭ 25 (-75%)
Mutual labels:  ffmpeg, mp4
Tricycle
Video transcoding... easier than riding a bike.
Stars: ✭ 35 (-65%)
Mutual labels:  ffmpeg, mp4

gifserver

gifserver is a service written in Go that transcodes GIFs to videos on the fly. Useful for displaying user uploaded GIFs on a website without incurring slowdowns from excess bandwidth.

The server is a wrapper around ffmpeg, you must have the ffmpeg command installed on your system.

The server will automatically cache transcoded GIFs to disk so subsequent requests will avoid the initial conversion time. The server is aware of what's currently being converted so multiple requests to the same GIF during a conversion do not trigger multiple conversions.

Install

go get github.com/leafo/gifserver

gifserver -help

Running

gifserver

By default the command will look for a config file named gifserver.json in the current directory. You can override the config file's path with the -config command line flag.

To transcode a GIF just request the server at the /transcode path with the URL of the GIF you would like converted: (The http:// is optional):

http://localhost:9090/transcode?url=leafo.net/dump/test.gif

The type of video will be detected from the Accept header. If nothing could be detected a MP4 is returned by default. If there are any problems an HTTP 500 error is returned and the server returns an error message.

The /transcode path takes the following query parameters:

  • url the url of the gif to load (required)
  • format the format to transcode to, either mp4, ogv, png (optional)

Using png as the format will return an image that has the first frame of the GIF.

Config

A JSON file is used to configure the server. The default config is as follows:

{
	"Address": ":9090",
	"Secret": "",
	"CacheDir": "gifcache",
	"MaxBytes": 5242880,
	"MaxWidth": 512,
	"MaxHeight": 512,
	"MaxConcurrency": 0
}

Your config can replace any combination of the defaults with your own values.

  • Address the address to bind the server to
  • Secret secret key to use for singed URLs. If "" is the secret key then signed URLs are disabled
  • CacheDir where to cache transcoded GIFs
  • MaxBytes the max size of GIF in bytes allowed to be processed, setting to 0 disabled
  • MaxWidth the max width of GIF that can be processed, setting to 0 disables
  • MaxHeight the max width of GIF that can be processed, setting to 0 disables
  • MaxConcurrency the max number of transcodes that can be in process at once, additional ones are queued. Setting to 0 disables

Signed URLs

You should used signed URLs whenever possible to avoid malicious users from triggering a denial-of-service-attack on your server by sending a large amount of conversion requests.

To enable signed URLs provide a Secret in your config file. The server uses SHA1 HMAC to generate signatures for URLs. Generating the signature is relatively simple:

Given the following request to transcode a GIF:

http://localhost:9090/transcode?url=leafo.net/dump/test.gif

Take the entire path and query from the URL an perform a SHA1 HMAC digest on it. Base64 encode the sum. Then append the URL escaped signature to the end of the URL as the query parameter sig:

sum = hmac_sha1(theSecret, "/transcode?url=leafo.net/dump/test.gif")
signature = encode_base64(sum)

signed_url = url + "&sig=" + url_escape(signature)

Then perform the request with the signed URL. You should always append the signature at the end of the URL. You must not change the order of the original query parameters in any way when appending the signature otherwise the signature is invalid.

Preventing Abuse

A few config options to prevent malicious GIFs from blocking the server are included.

MaxBytes, MaxWidth, and MaxHeight should all be set to reasonable values to prevent large images from being loaded and taking up a large amount of memory.

MaxConcurrency should be set to prevent an influx of trascode requests from taking over the CPU.

About

Author: Leaf Corcoran (leafo) (@moonscript)
Email: [email protected]
Homepage: http://leafo.net
License: MIT, Copyright (C) 2014 by Leaf Corcoran

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].