screencap
Advanced tools
Comparing version 0.0.2 to 0.0.4
@@ -35,3 +35,3 @@ var ffmpeg = require('fluent-ffmpeg'); | ||
}); | ||
} | ||
}; | ||
this.gif = function(height,duration) { | ||
@@ -59,3 +59,3 @@ console.log("Starting Screen Recording: Duration ", duration, " seconds"); | ||
}); | ||
} | ||
}; | ||
this.shot = function() { | ||
@@ -79,3 +79,27 @@ console.log("Starting Screen Shot"); | ||
}); | ||
} | ||
}; | ||
this.pipe = function(res) { | ||
console.log("Starting Screen Capture: Duration ", duration, " seconds"); | ||
console.log("Screen Capture Piped"); | ||
console.log("Press Ctrl+C To Abort The Capture"); | ||
ffmpeg() | ||
.videoCodec(this.videoCodec) | ||
.videoBitrate(this.videoBitrate) | ||
.audioBitrate(this.audioBitrate) | ||
.addOptions([ | ||
"-movflags frag_keyframe+faststart" | ||
]) | ||
.input(':0.0+0,0') | ||
.inputOptions([ | ||
'-t '+ duration +'', | ||
'-f x11grab' | ||
]) | ||
.on('end', function() { | ||
console.log('Screen Capture Completed.'); | ||
}) | ||
.output(pipe) | ||
.on('error', function(e) { | ||
console.log("ERROR:",e); | ||
}); | ||
}; | ||
@@ -82,0 +106,0 @@ return this; |
@@ -35,3 +35,3 @@ var ffmpeg = require('fluent-ffmpeg'); | ||
}); | ||
} | ||
}; | ||
this.gif = function(height,duration) { | ||
@@ -59,3 +59,3 @@ console.log("Starting Screen Recording: Duration ", duration, " seconds"); | ||
}); | ||
} | ||
}; | ||
this.shot = function() { | ||
@@ -79,3 +79,27 @@ console.log("Starting Screen Shot"); | ||
}); | ||
} | ||
}; | ||
this.pipe = function(res) { | ||
console.log("Starting Screen Capture: Duration ", duration, " seconds"); | ||
console.log("Screen Capture Piped"); | ||
console.log("Press Ctrl+C To Abort The Capture"); | ||
ffmpeg() | ||
.videoCodec(this.videoCodec) | ||
.videoBitrate(this.videoBitrate) | ||
.audioBitrate(this.audioBitrate) | ||
.addOptions([ | ||
"-movflags frag_keyframe+faststart" | ||
]) | ||
.input('video=0') | ||
.inputOptions([ | ||
'-t '+ duration +'', | ||
'-f avfoundation' | ||
]) | ||
.on('end', function() { | ||
console.log('Screen Capture Completed.'); | ||
}) | ||
.output(pipe) | ||
.on('error', function(e) { | ||
console.log("ERROR:",e); | ||
}); | ||
}; | ||
@@ -82,0 +106,0 @@ return this; |
@@ -7,7 +7,15 @@ var ffmpeg = require('fluent-ffmpeg'); | ||
self = this; | ||
if (typeof fileout == "undefined") { fileout = options; } | ||
if (typeof fileout == "undefined") { fileout = false; } | ||
if (typeof options == "undefined") { options = {}; } | ||
if (typeof options.videoCodec == "undefined") { options.videoCodec = false; } | ||
if (typeof options.videoBitrate == "undefined") { options.videoBitrate = false; } | ||
if (typeof options.audioBitrate == "undefined") { options.audioBitrate = false; } | ||
this.videoCodec = options.videoCodec || "libx264"; | ||
this.videoBitrate = options.videoBitrate || "1000k"; | ||
this.audioBitrate = options.audioBitrate || "96k"; | ||
this.file = path.resolve(""+ fileout +""); | ||
if (fileout) { | ||
this.file = path.resolve(""+ fileout +""); | ||
} else { | ||
this.file = null; | ||
} | ||
this.capture = function(duration) { | ||
@@ -40,3 +48,3 @@ console.log("Starting Screen Capture: Duration ", duration, " seconds"); | ||
}); | ||
} | ||
}; | ||
this.gif = function(height,duration) { | ||
@@ -64,3 +72,3 @@ console.log("Starting Screen Recording: Duration ", duration, " seconds"); | ||
}); | ||
} | ||
}; | ||
this.shot = function() { | ||
@@ -84,3 +92,50 @@ console.log("Starting Screen Shot"); | ||
}); | ||
} | ||
}; | ||
this.capturePipe = function(duration,res) { | ||
console.log("Starting Screen Capture: Duration ", duration, " seconds"); | ||
console.log("Screen Capture Piped"); | ||
console.log("Press Ctrl+C To Abort The Capture"); | ||
ffmpeg() | ||
.videoCodec(this.videoCodec) | ||
.videoBitrate(this.videoBitrate) | ||
.audioBitrate(this.audioBitrate) | ||
.addOptions([ | ||
"-movflags frag_keyframe+faststart", | ||
"-preset ultrafast", | ||
"-tune zerolatency", | ||
"-threads 0", | ||
"-async 1" | ||
]) | ||
.input('video=screen-capture-recorder') | ||
.inputOptions([ | ||
'-t '+ duration +'', | ||
'-f dshow' | ||
]) | ||
.on('end', function() { | ||
console.log('file has been converted succesfully'); | ||
}) | ||
.on('error', function(err) { | ||
console.log('an error happened: ' + err.message); | ||
}) | ||
.pipe(res, {end:true}); | ||
}; | ||
this.shotPipe = function(res) { | ||
console.log("Starting Screen Shot"); | ||
console.log("Piping"); | ||
ffmpeg() | ||
.videoBitrate(this.videoBitrate) | ||
.audioBitrate(this.audioBitrate) | ||
.duration('0.1') | ||
.input('video=screen-capture-recorder') | ||
.inputOptions([ | ||
'-f dshow' | ||
]) | ||
.on('end', function() { | ||
console.log('file has been converted succesfully'); | ||
}) | ||
.on('error', function(err) { | ||
console.log('an error happened: ' + err.message); | ||
}) | ||
.pipe(res, {end:true}); | ||
}; | ||
@@ -87,0 +142,0 @@ return this; |
{ | ||
"name": "screencap", | ||
"version": "0.0.2", | ||
"version": "0.0.4", | ||
"description": "A Screen Capture (Image & Video) Library", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"fluent-ffmpeg": "^2.0.0-rc3" | ||
"fluent-ffmpeg": "*" | ||
}, | ||
@@ -27,0 +27,0 @@ "directories": { |
@@ -15,3 +15,3 @@ #ScreenCap | ||
- http://sourceforge.net/projects/screencapturer/ | ||
- http://ffmpeg.org/ | ||
- http://ffmpeg.org/ *Optional | ||
@@ -85,4 +85,10 @@ Using microsoft windows sdk 7 open the CMD Shell supplied with the SDK. Then type the following. | ||
Piping can also be used to directly render a desktop through a response function such as express res. The most basic example is to pipe the screen to an express server. | ||
```javascript | ||
``` | ||
##CONTRIBUTING | ||
We encourage forking. Feel free to fork & pull your new additions, or bug fixes. |
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
154993
14
414
93
2
Updatedfluent-ffmpeg@*