1.4.2 • Published 8 years ago
vidthumb v1.4.2
video-thumbnail-extractor
Dynamically extract thumbnails from videos with optional cropping.
GET /:url?frame=&x=&y=&width=&height=&maxsize=
url should be encodeURIComponented.
frame defaults to 0.
x, y, width, and height must all be defined to be valid.
Returns a jpeg image.
GET /:encryptedUrl?frame=&x=&y=&width=&height=&maxsize=
Same as above, but with encrypting the URLs instead of encoding. This is so people don't know the original video URL as well as not allow arbitrary videos. Here's how to encrypt a URL:
var crypto = require('crypto');
var hostname = 'http://localhost:3000';
var password = 'some-password-you-set';
function encrypt(url) {
var cipher = crypto.createCipher('aes256', password);
var buffers = [];
buffers.push(cipher.update(url));
buffers.push(cipher.final());
return hostname + '/' + Buffer.concat(buffers).toString('hex');
}Now accessing encrypt(url) + '?frame=' + index will return the image at a specific index.
1.4.2
8 years ago