Meteor.JS CollectionFSvideo图像缩略图(graphicsMagick)

我正在使用CollectionFS上传文件的一个Meteor应用程序。

我能够上传并生成图像的缩略图。

但是我的问题是:我应该如何为video创build缩略图?

我可以看到,它可以通过命令行︰https : //superuser.com/questions/599348/can-imagemagick-make-thumbnails-from-video

但是我怎么能把这个应用到我的Meteor代码中。

这是我在做什么:

VideoFileCollection = new FS.Collection("VideoFileCollection", { stores: [ new FS.Store.FileSystem("videos", {path: "/uploads/videos"}), new FS.Store.FileSystem("videosthumbs", {path: "/uploads/videosthumbs", beforeWrite: function(fileObj) { // We return an object, which will change the // filename extension and type for this store only. return { extension: 'png', type: 'image/png' }; }, transformWrite: function(fileObj, readStream, writeStream) { gm(readStream, fileObj.name()).stream('PNG').pipe(writeStream); } }) ] }); 

这里发生了什么,video上传到“video”文件夹和一个PNG创build下的“videosthumbs”与0字节和缩略图没有得到生成。

我也读过: https : //github.com/aheckmann/gm#custom-arguments

我们可以使用:gm()。command() – 自定义命令,如标识或转换

任何人都可以告诉我可以做些什么来处理这种情况?

感谢致敬

检查你添加的链接,这是一个粗略的解决scheme,可以帮助你

 ffmpeg -ss 600 -i input.mp4 -vframes 1 -s 420x270 -filter:v 'yadif' output.png 

这是我所做的一个function。

 var im = require('imagemagick'); var args = [ "ffmpeg", "-ss", "600", "-i", "input.mp4", "-vframes", " 1", "-s", "420x270", "-filter:v", "'yadif'", "output.png" ]; // Function to convert and im.convert(args, function(err) if (err) throw err; });