标签: node-gm

Meteor.JS CollectionFS视频到图像缩略图(图形Magick)

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

我可以上传和生成图像的缩略图.

但我的问题是:我应该如何为视频创建缩略图?

我可以看到它可以通过命令行: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);

    }
  })
]
});
Run Code Online (Sandbox Code Playgroud)

这里发生了什么,视频上传到"视频"文件夹,一个PNG在"videosthumbs"下创建,0字节,缩略图没有生成.

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

我们可以使用:gm().command() - 自定义命令,如识别或转换

任何人都可以告诉我如何处理这种情况?

感谢致敬

node.js graphicsmagick meteor node-gm collectionfs

7
推荐指数
1
解决办法
580
查看次数

标签 统计

collectionfs ×1

graphicsmagick ×1

meteor ×1

node-gm ×1

node.js ×1