Created
July 30, 2014 20:46
-
-
Save lomadurov/024ffbf1dbd23e6c457c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var ffmpeg = require('fluent-ffmpeg'); | |
function getFull(inputFile, outputName) { | |
getVideo(inputFile, 'mp4', outputName); | |
getVideo(inputFile, 'ogv', outputName); | |
getVideo(inputFile, 'webm', outputName); | |
} | |
function getVideo(inputFile, type, outputName) { | |
var codec = type === 'ogv' ? 'libtheora' : type === 'webm' ? 'libvpx' : 'libx264' | |
ffmpeg() | |
.input('./.in/' + inputFile) | |
.inputFormat('gif') | |
.input('./watermark2.png') | |
.noAudio() | |
.videoCodec(codec) | |
.videoBitrate('400k') | |
.complexFilter(['scale=trunc(iw/2)*2:trunc(ih/2)*2[rescaled]', { | |
filter: "overlay", | |
options: { x: 'main_w-overlay_w-10', y: 'main_h-overlay_h-10' }, | |
inputs: 'rescaled', | |
outputs: 'result' | |
}], 'result') | |
.output('./.out/' + outputName + '.' + type) | |
.on('end', function() { | |
console.log('Finished processing'); | |
}) | |
.run(); | |
} | |
getFull('3.gif', '3'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment