0

I have trouble understanding fluent-ffmpeg.

I'm trying to make a screen recorder with Fluent-ffmpeg but couldn't find the correct code. The output should consist of a screen, webcam and microphone.

ffmpeg command line code works successfully. enter image description here

ffmpeg code:

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):

 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

1 Answers1

0

This not be solution of my question but it solved my problem. I solved it using spawn instead of 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);