I'm trying to make complex filters with fluent ffmpeg work, but getting the error:
Stream specifier 'pts' in filtergraph description [0:v]setpts=0.3333333333333333*PTS[pts];[pts]crop=out_w=3381.4186868767238:out_h=1728:x=0:y=0[left];[pts]crop=out_w=74.58131312327646:out_h=1728:x=3381.4186868767238:y=0[right];[left][right]hstack=inputs=2[orientated];[1:v]scale=3456:1728[hs1];[hs1]colorkey=0x00ff00:0.8:0.1[hs1x];[orientated][hs1x]overlay[out] matches no streams.
This is how I'm trying to build the filter
const filter = []
let init = '[0:v]'
if(node.video.playBackRate){
filter.push({filter: 'setpts',options: 1/node.video.playBackRate+'*PTS', inputs: init, outputs: '[pts]'})
init = '[pts]'
}
if(node.scene && node.scene.cameraDefault){
const theta = JSON.parse(node.scene.cameraDefault).rotationY
const per = height * (theta/180)
const left = height + per
const right = height - per
filter.push({filter: 'crop',options: {out_w: left, out_h: height, x: 0, y: 0}, inputs: init, outputs: '[left]'})
filter.push({filter: 'crop',options: {out_w: right, out_h: height, x: left, y: 0}, inputs: init, outputs: '[right]'})
filter.push({filter: 'hstack',options: {inputs : 2}, inputs: ['[left]','[right]'], outputs: '[orientated]'})
init = '[orientated]'
}
if(node.hotspots){
const overlays = [init]
node.hotspots.forEach((hotspot, index) => {
if(hotspot.render){
const options = {}
if(hotspot.startTime)
options['-ss'] = hotspot.startTime
if(hotspot.endTime)
options['-t'] = hotspot.endTime - (hotspot.startTime || 0)
node.ffmpeg.addInput(dir + '/' + hotspot.render)//.withInputOptions(options)
filter.push({filter: 'scale', options: `${width}:${height}`, inputs: `[${index + 1}:v]`, outputs: `[hs${index+1}]`})
filter.push({filter: 'colorkey', options: '0x00ff00:0.8:0.1', inputs: `[hs${index+1}]`, outputs: `[hs${index+1}x]`})
overlays.push(`[hs${index+1}x]`)
}
})
filter.push({filter: 'overlay', inputs: overlays, outputs: '[out]'})
}
node.ffmpeg.complexFilter(filter, '[out]')
Where am I going wrong?
I assume it's the right hand crop filter.. I need to somehow run those filters with the same input..
Answer
Don't know the syntax of fluent-ffmpeg, but I can identify the issue, You can't reuse filter outputs generated within the filtergraph. The method needed is to split the output, so the initial part of the filtergraph would look like this,
[0:v]setpts=0.3333333333333333*PTS,split=2[pts1][pts2];
[pts1]crop=out_w=3381.4186868767238:out_h=1728:x=0:y=0[left];
[pts2]crop=out_w=74.58131312327646:out_h=1728:x=3381.4186868767238:y=0[right];
No comments:
Post a Comment