简体   繁体   English

ffmpeg 命令行代码转换为 fluent-ffmpeg

[英]ffmpeg command line code translate to fluent-ffmpeg

I have trouble understanding fluent-ffmpeg.我无法理解 fluent-ffmpeg。

I'm trying to make a screen recorder with Fluent-ffmpeg but couldn't find the correct code.我正在尝试使用 Fluent-ffmpeg 制作屏幕录像机,但找不到正确的代码。 The output should consist of a screen, webcam and microphone.输出应包括屏幕、网络摄像头和麦克风。

ffmpeg command line code works successfully. ffmpeg 命令行代码成功运行。 在此处输入图片说明

ffmpeg code: ffmpeg 代码:

ffmpeg -ss 00:00:3 -thread_queue_size 4096 -f avfoundation -framerate 25 -i 1 -thread_queue_size 4096 -f avfoundation -framerate 25 -video_size 320x240 -i 0:0 -c:v libx264 -crf 18 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -r 25 video.mp4

my fluent-ffmpeg code:(ı know bad code):我的 fluent-ffmpeg 代码:(我知道坏代码):

 command = ffmpeg("1")
        .videoCodec('libx264')
        .inputFPS(25)
        .size("1280x800")
        .inputFormat('avfoundation')  
         .input("0")
         .inputFormat('avfoundation')  
         .inputFPS(25)
          .size("320x240")
         .addOptions(["-filter_complex", "overlay=main_w-overlay_w-10:main_h-overlay_h-10 "])
        
     
        .addOption([  "-preset" , "ultrafast"  ])
       .save(`/Users/macbook/Pictures${new Date().toLocaleString().split('-').join('').split(':').join('')}.mp4`)

i tried this but also this not worked :我试过了,但这也不起作用:

     //.size("320x240")

   .complexFilter(['scale=320:240[rescaled]',
{
   filter: 'overlay', options: { x: 'main_w-overlay_w-10', y: 'main_h-overlay_h-10' },
   inputs: ['[0:v]','[1:v]'], outputs: '[a1][a2]'
 }
],'[a1][a2]')

I would be very happy if you show me the right method.如果你告诉我正确的方法,我会很高兴。 I will be happier if you also add a microphone.如果您还添加麦克风,我会更高兴。 thank you so much太感谢了

This not be solution of my question but it solved my problem.这不是我的问题的解决方案,但它解决了我的问题。 I solved it using spawn instead of ffmpeg.我使用 spawn 而不是 ffmpeg 解决了它。

my code :我的代码:

    var args = [
        '-ss', '00:00:3',
        '-thread_queue_size', '4096' ,'-f' , 'avfoundation', '-framerate', '25' ,'-i' ,'1', 
        '-thread_queue_size', '4096' ,'-f' , 'avfoundation', '-framerate', '25' ,'-video_size', '320x240' ,'-i' ,'0:0' ,
        '-c:v', 'libx264', '-crf', '2', '-preset', 'ultrafast',
        '-filter_complex', 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' ,
        '-r', '25', 'Dektop record'+Date().toString()+'.mp4'
    ];
 command = spawn(ffmpegPath, args);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM