Giter VIP home page Giter VIP logo

video-thumbnailer's Introduction

Video Thumbnailer

Deploy with docker-compose or however you want.

URL parameters are:

  • url: The publically available video file
  • s: the second into the video that the screenshot should be taken (defaults to 2)
  • fmt: format of the image, either png, jpg, or jpeg (defaults to jpg)

Response

The response will be the binary output of the screenshot image. The image is currently not scaled.

Headers returned include:

  • Content-Disposition: attachment; filename="{unique id.png}"
  • Content-Type: [ image/png | image/jpeg ]
  • Content-Length: [ integer num bytes ]

Example

Run the image

docker run --rm -d -p 9999:8080 markkimsal/video-thumbnailer:2.0.0

Test the service:

 curl -O -J -X GET "http://127.0.0.1:9999/index.php?url=https://github.com/markkimsal/video-thumbnailer/raw/master/fixtures/ISS-live-stream-earth-from-space-2020-05-08.mp4&s=3.8"

This will download the file and use the header from Content-disposition: attachment;filename="" to save the file locally.

The filename is a ULID.

Caching

Public cache-control headers are sent along with an expires for 1 month. Adjust the nginx-vhost.conf file to suit your needs and rebuild with docker-compose.

Security

This is essentially an open proxy, so secure it with:

  • firewall rules
  • reverse proxy
  • docker swarm networks
  • k8s

You can restrict the video downloading to a list of known hosts via the DOMAINS environment variable.

#docker-compose.yml

    environment:
       - DOMAINS=github.com,igotaprinter.com

If the requested video's host does not match something in the list, it will be rejected with '422 Unprocesible Entity'. Matching is done with the host component of php's parse_url() function.

video-thumbnailer's People

Contributors

markkimsal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

henrikmatos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.