Created
May 20, 2016 18:07
-
-
Save jeffcrouse/ed6bdcd0c6a5b4e5283297f8bfbd7af7 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 half = duration/2.0; | |
var s = options.size; | |
var filters = [ // setpts=2.0*PTS, | |
util.format("[0:v]setsar=sar=1[open]"), | |
util.format("[1:v]trim=start=%s:end=%s,crop=in_h:in_h:(in_w/2)-(in_h/2):0,scale=%s:%s,setpts=PTS-STARTPTS,setsar=sar=1[player1]", 1, 3, s, s), | |
util.format("[1:v]trim=start=%s:end=%s,crop=in_h:in_h:(in_w/2)-(in_h/2):0,scale=%s:%s,setpts=PTS-STARTPTS,setsar=sar=1[player2]", duration-2, duration, s, s), | |
util.format("[2:v]setpts=PTS-STARTPTS,setsar=sar=1[horse1]"), | |
util.format("[3:v]setpts=PTS-STARTPTS,setsar=sar=1[horse2]"), | |
util.format("[4:v]setpts=PTS-STARTPTS,setsar=sar=1[close]"), | |
util.format("[5:v]setpts=PTS-STARTPTS,setsar=sar=1[scratches]"), | |
util.format("[open][player1][horse1][player2][horse2][close]concat=n=6[mix]"), | |
util.format("[mix][scratches]blend=all_mode='overlay':repeatlast=1:all_opacity=1,fps=%s", options.fps) | |
]; | |
// -tune film | |
var cmd = util.format('ffmpeg -y -i "%s" -i "%s" -i "%s" -i "%s" -i "%s" -i "%s" ', | |
FIRST_TITLE, self.original, HORSIES1, HORSIES2, END_TITLE, SCRATCHES); | |
cmd += util.format('-filter_complex "%s" ', filters.join(";")); | |
cmd += util.format('-an -c:v libx264 -preset %s -crf %s -an -pix_fmt yuv420p "%s"', | |
options.preset, options.crf, new_name); | |
console.log(cmd); | |
console.time(format) | |
exec(cmd, function(error, stdout, stderr){ | |
console.timeEnd(format) | |
if(error) return callback(error); | |
fs.access(new_name, fs.R_OK, function (err) { | |
if(err) return callback("failed to make "+format); | |
self.local.push({path: new_name, format: format}); | |
self.save(callback); | |
//exec(util.format('open "%s"', new_name)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment