Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

init

  • Loading branch information...
commit 1010c7e3801bb7af25b6213416b5ee01d066c13a 0 parents
@vdemedes authored
3  .gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+node_modules
+*.sock
4 .npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
5 History.md
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
5 Makefile
@@ -0,0 +1,5 @@
+
+test:
+ @echo "populate me"
+
+.PHONY: test
42 Readme.md
@@ -0,0 +1,42 @@
+# video-thumb
+
+ Extract snapshots from video at a given time. Requires ffmpeg.
+
+# Installation
+
+```npm install video-thumb```
+
+# Usage
+
+```
+var thumbler = require('video-thumb');
+
+thumbler.extract('video.mp4', 'snapshot.png', '00:00:22', '200x125', function(){
+
+ console.log('snapshot saved to snapshot.png (200x125) with a frame at 00:00:22');
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 Vadim Demedes <sbioko@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2  index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/video-thumb');
6 lib/video-thumb.coffee
@@ -0,0 +1,6 @@
+exec = require('child_process').exec
+
+module.exports =
+ extract: (path, destPath, time = '00:00:01', size = '200x125', callback) ->
+ exec 'ffmpeg -ss ' + time + ' -vframes 1 -i ' + path + ' -y -s ' + size.replace('x', '*') + ' -f image2 ' + destPath, ->
+ callback() if callback
17 lib/video-thumb.js
@@ -0,0 +1,17 @@
+var exec;
+exec = require('child_process').exec;
+module.exports = {
+ extract: function(path, destPath, time, size, callback) {
+ if (time == null) {
+ time = '00:00:01';
+ }
+ if (size == null) {
+ size = '200x125';
+ }
+ return exec('ffmpeg -ss ' + time + ' -vframes 1 -i ' + path + ' -y -s ' + size.replace('x', '*') + ' -f image2 ' + destPath, function() {
+ if (callback) {
+ return callback();
+ }
+ });
+ }
+};
10 package.json
@@ -0,0 +1,10 @@
+{
+ "name": "video-thumb"
+ , "version": "0.0.1"
+ , "description": "Extract snapshots from video at a given time. Requires ffmpeg."
+ , "keywords": ["ffmpeg", "video", "thumb", "thumbnail", "video thumbnail"]
+ , "author": "Vadim Demedes <sbioko@gmail.com>"
+ , "dependencies": {}
+ , "main": "index"
+ , "engines": { "node": "0.4.x" }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.