2016-07-06 76 views

回答

0

你可能可以使用一组滤镜来获得你想要的。 你先重新调整第一视频所需的大小左:https://ffmpeg.org/ffmpeg-filters.html#scale-1

'scale=width:height'

然后应用黑边来定位左侧的视频; totalwidthtotalheight是输出视频的最终尺寸,xy您的重新调整,左侧视频的位置:https://ffmpeg.org/ffmpeg-filters.html#pad-1

{ 
    filter: 'pad', 
    options: 'totalwidth:totalheigth:x:y' 
} 

最后,使用复杂的过滤器overlay把你的右侧的视频;注意,应首先重新调整:https://ffmpeg.org/ffmpeg-filters.html#overlay-1

{ 
    filter: 'overlay', options: { x: 'x', y: 'y' }, 
}, 

这里是你的代码应该是什么样子:(基于快速文档上:https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#complexfilterfilters-map-set-complex-filtergraph

ffmpeg('left_video.avi') 
.input('right_video.avi') 
.complexFilter([ 
// Rescale input video 
'scale=width:height', 

// Add black bars to position your left video at x, y position 
{ 
    filter: 'pad', 
    options: 'totalwidth:totalheigth:x:y' 
} 

// Overlay the second input for right side video 
{ 
    filter: 'overlay', options: { x: 'x', y: 'y' }, 
}, 
], 'output'); 

注意我没有测试它 ,但它应该工作