Search code examples
node.jsffmpegvideo-processing

How can i increase my fps output ? (ffmpeg, nodejs)


I'm having quite the trouble understanding how fps output works.

I have a video workflow through node and ffmpeg that transform picture into scrolling videos, here is the command :

const ffmpeg = spawn('ffmpeg', ['-f', 'lavfi', '-i', 'color=s=1280x720', '-loop', '1', '-i', `${path}/${video.name}`, '-filter_complex', `[1:v]scale=1280:-2,format=yuv420p,fps=fps=60[fg]; [0:v][fg]overlay=y=-\'t*h*0.02\'[v]`, '-map', '[v]', '-t', `${clipDuration}`, `./${path}/${video.name}-wip.mp4`])
ffmpeg.stderr.on('data', (data) => {
  console.log(`${data}`);
});
ffmpeg.on('close', (code) => {
  const ffmpeg2 = spawn('ffmpeg', ['-i', `./${path}/${video.name}-wip.mp4`, '-vf', `tpad=stop_mode=clone:stop_duration=3,fade=type=in:duration=1,fade=type=out:duration=1:start_time=${clipDuration + 2}`, `./${path}/${video.name}.mp4`])
  ffmpeg2.stderr.on('data', (data) => {
    console.log(`${data}`);
  });
  ffmpeg2.on('close', (code) => {
    resolve();
  });
})

First ffmpeg command create a scrolling video from picture, second ffmpeg command add a fade out transition and a pause to this video.

FPS output for this is 25. How can i increase it to 60 so that scrolling isn't stuttering anymore ?

Thanks for your time.


Solution

  • try this

    const ffmpeg2 = spawn('ffmpeg', ['-i', `./${path}/${video.name}-wip.mp4`, '-vf', `framerate=fps=60,tpad=stop_mode=clone:stop_duration=3,fade=type=in:duration=1,fade=type=out:duration=1:start_time=${clipDuration + 2}`, `./${path}/${video.name}.mp4`])
    

    Note this from https://superuser.com/questions/1265642/ffmpeg-slideshow-with-crossfade:

    ffmpeg -i temp.mp4 -vf "framerate=fps=60" -codec:v mpeg4 out.mp4