Commit 252043ce authored by Jan Göttlich's avatar Jan Göttlich

as requested change of origin to regiolab
parent c21cd942
File added
# See https://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/playground/tmp/*
# dependencies
/node_modules
/bower_components
# misc
/.sass-cache
/connect.lock
/coverage/*
/tests
/bower_components
/libpeerconnection.log
npm-debug.log*
testem.log
.meteor/local
.meteor/meteorite
# Video thumbnails + WebVTT using Node.js
npm # Video thumbnails + WebVTT using Node.js
Thumbnails generator module. Uses [WebVTT](http://dev.w3.org/html5/webvtt/) as thumbnails descriptor. Can pack thumbnails into spritesheet using [node-sprit]() module.
......
......@@ -56,12 +56,10 @@ module.exports = function(source, options, callback) {
}
metadata = data
if (!options.timemarks) {
options.timemarks = []
}
options.bounds = []
var mark
, i = 0
......@@ -105,7 +103,6 @@ module.exports = function(source, options, callback) {
mark += options.framesPerThumbnail / metadata.fps
}
}
if (!options.size) {
options.size = {
width: metadata.width,
......
......@@ -22,12 +22,14 @@ var FFmpeg = require('fluent-ffmpeg')
* @param {thumbnailsCallback} callback Accepts arguments: (err, filenames)
*/
exports.generateThumbnails = function(source, options, callback) {
new FFmpeg({source: source})
.withSize(toSizeString(options.size))
let mysize = toSizeString(options.size);
console.log(mysize);
new FFmpeg(source)
.on('error', onerror)
.on('end', success)
.takeScreenshots(
.screenshots(
{
size: mysize,
count: options.timemarks.length,
timemarks: options.timemarks
},
......@@ -100,7 +102,7 @@ exports.metadata = function(source, callback) {
* @returns {string}
*/
function toSizeString(dimensions) {
return dimensions.width + 'x' + dimensions.height
return dimensions.width + 'x' + Math.round(dimensions.height)
}
exports.toSizeString = toSizeString
......
......@@ -21,9 +21,9 @@
"url": "https://github.com/estliberitas/node-thumbnails-webvtt/issues"
},
"dependencies": {
"fluent-ffmpeg": "^1.7.2",
"fs-extra": "^0.10.0",
"lodash": "^2.4.1",
"fluent-ffmpeg": "^2.1.2",
"fs-extra": "^4.0.1",
"lodash": "^4.17.4",
"moment": "^2.7.0",
"node-sprite": "^0.1.2"
},
......
'use strict';
let thumbgen = require('../lib/index');
thumbgen('./tmp/oceans.mp4', {
output: './tmp/vtt/myVTT.vtt',
size: {
width: 100
},
numThumbnails: 6,
spritesheet: true
}, function(err, metadata) {
if (err) {
console.error(err);
throw err
}
console.log(metadata)
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment