Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ gify('out.mp4', 'out.gif', opts, function(err){
- `rate` frame rate [10]
- `start` start position in seconds or hh:mm:ss[.xxx] [0]
- `duration` length of video to convert in seconds or hh:mm:ss[.xxx] [auto]
- `transpose` rotation of video default [transpose=0]
```
The possible values ​​to `transpose` are:
0=90CounterCLockwise and Vertical Flip(default)
1=90Clockwise
2=90CounterClockwise
3=90Clockwise and Vertical Flip
```

# License

Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ module.exports = gify;
* - `rate` frame rate [10]
* - `start` start position in seconds [0]
* - `duration` length of video to convert [auto]
*
* - `transpose` rotation of video default [transpose=0]
* the possible values ​​to `transpose` are:
* 0=90CounterCLockwise and Vertical Flip (default)
* 1=90Clockwise
* 2=90CounterClockwise
* 3=90Clockwise and Vertical Flip
* @param {Type} name
* @return {Type}
* @api public
Expand All @@ -48,6 +53,7 @@ function gify(input, output, opts, fn) {
var h = opts.height;
var rate = opts.rate || 10;
var delay = opts.delay || 'auto';
var transpose = opts.transpose || 'transpose=0';

// auto delay
if ('auto' == delay) {
Expand All @@ -67,6 +73,7 @@ function gify(input, output, opts, fn) {

// escape paths
input = escape([input]);
transpose = escape([transpose])
output = escape([output]);
// normalize
if (process.platform === 'win32') {
Expand All @@ -87,6 +94,7 @@ function gify(input, output, opts, fn) {
// convert to gif
var cmd = ['ffmpeg'];
cmd.push('-i', input);
cmd.push('-vf', transpose);
cmd.push('-filter:v', 'scale=' + scale);
cmd.push('-r', String(rate));
if (opts.start) cmd.push('-ss', String(opts.start));
Expand Down