Я пытаюсь сделать сложные фильтры с беглой работой ffmpeg, но получаю ошибку:

Спецификатор потока 'pts' в описании filtergraph [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: х = +3381,4186868767238: у = 0 [вправо]; [влево] [вправо] hstack = входы = 2 [ориентирована]; [1:v] масштаб = 3456: 1728 [HS1]; [ hs1] colorkey = 0x00ff00: 0.8: 0.1 [hs1x]; [ориентированное] [hs1x] оверлей [out] не соответствует ни одному потоку.

Вот как я пытаюсь построить фильтр

     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]')

Куда я иду не так?

Я предполагаю, что это правый фильтр обрезки .. Мне нужно как-то запустить эти фильтры с тем же входом ..

1 ответ1

0

Не знаю синтаксис fluent-ffmpeg, но я могу определить проблему: вы не можете повторно использовать выходные данные фильтра, сгенерированные в фильтре графа. Нужный метод - разделить вывод, чтобы начальная часть графа фильтра выглядела так:

[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];

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .