-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from noblesamurai/loop_option
Allows you to not loop.
- Loading branch information
Showing
6 changed files
with
190 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "ffmpeg-loop", | ||
"description": "Instantiate ffmpeg in looping mode.", | ||
"version": "2.0.0", | ||
"version": "2.1.0-loop-option.4", | ||
"author": "Tim Allen <[email protected]>", | ||
"license": "BSD", | ||
"main": "src/index.js", | ||
|
@@ -21,30 +21,41 @@ | |
"url": "https://github.com/noblesamurai/ffmpeg-loop/issues" | ||
}, | ||
"engines": { | ||
"node": "8.x", | ||
"npm": "5.x" | ||
"node": "^10 || ^12", | ||
"npm": "6.x" | ||
}, | ||
"files": [ | ||
"src" | ||
], | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"fluent-ffmpeg": "^2.1.2", | ||
"lodash.last": "^3.0.0" | ||
"lodash.last": "^3.0.0", | ||
"ow": "^0.17.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"dirty-chai": "^1.2.2", | ||
"ffmpeg-static": "^2.1.0", | ||
"ffmpeg-static": "^4.0.1", | ||
"jsdoc-to-markdown": "~3.0.0", | ||
"mocha": "~3.3.0", | ||
"mocha": "^7.1.0", | ||
"nyc": "^10.1.2", | ||
"p-event": "^4.1.0", | ||
"semistandard": "*" | ||
}, | ||
"peerDependencies": { | ||
"ffmpeg-static": "^2.1.0" | ||
"ffmpeg-static": "^4" | ||
}, | ||
"keywords": [], | ||
"nyc": { | ||
"exclude": [ | ||
"coverage", | ||
"test" | ||
] | ||
}, | ||
"semistandard": { | ||
"env": [ | ||
"mocha" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Generate a crop filter (if required) to the ffmpeg command based on provided opts. | ||
* All crop dimensions are for the original video size (not the output size). | ||
* | ||
* @param {Array<string>} filters The filters array - will be modified in place if applicable | ||
* @param {integer} opts.cropWidth - crop width (width and height are required). | ||
* @param {integer} opts.cropHeight - crop height | ||
* @param {integer} opts.cropX - crop x (x and y are optional. If not set, the | ||
* default is the center position of the video). | ||
* @param {integer} opts.cropY - crop y | ||
* @return {object|false} The crop filter. | ||
*/ | ||
function cropFilter (opts) { | ||
const { cropWidth, cropHeight, cropX, cropY } = opts; | ||
if (!cropWidth || isNaN(cropWidth) || !cropHeight || isNaN(cropHeight)) { | ||
return false; | ||
} | ||
const crop = [cropWidth, cropHeight]; | ||
if (!isNaN(cropX) && !isNaN(cropY)) crop.push(cropX, cropY); | ||
return { | ||
filter: 'crop', | ||
options: crop.join(':') | ||
}; | ||
} | ||
|
||
module.exports = cropFilter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters