Sunday, 19 March 2017

ffmpeg (via videoshow - node lib) taking an inordinately long time to encode mp4

I am using videoshow to programmatically create batches of videos. These videos contain a single image, and an audio track - they are very simple and range from 30 seconds to a few minutes in length.

Here is the basic config I'm using:

const videoOptions = {
  fps: 25,
  transition: true,
  transitionDuration: 0,
  videoBitrate: 1024,
  videoCodec: 'libx264',
  size: '1080x?',
  speed: 'ultrafast',
  audioBitrate: '128k',
  audioChannels: 2,
  format: 'mp4',
  pixelFormat: 'yuv420p',
  subtitleStyles: {
    Fontname: "Helvetica",
    Fontsize: "140",
    PrimaryColour: 16777215,
    SecondaryColour: 16777215,
    TertiaryColour: 16777215,
    BackColour: -2147483640,
    Bold: -1,
    Italic: 0,
    BorderStyle: 0,
    Outline: 0,
    Shadow: 3,
    Alignment: 1,
    MarginL: 40,
    MarginR: 60,
    MarginV: 100,
  }
}

When I try to run a batch of 5 videos (all encoding at the same time), this spikes my CPU to 100% on a high-end MBP, and lags for a very long time - over 30 minutes.

I'm aware there are speed settings, like ultrafast and medium. Does anyone have any idea how I set those here?

Is it normal to take 30 minutes to create 5 videos of one minute in duration each? What am I doing wrong?



via John Doe

No comments:

Post a Comment